OOPS Java Flashcards

1
Q

abstract classes

A

provide complete, default code and/or just details that have to be overriden. only extends 1. can have non-abstract methods, constructors, instance variables, or public,private,protected. fast. more for reusability

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

interfaces

A

cannot provide code only signature, implement several interfaces. all methods are abstracts. only public or none members. only static/final variables. slower. methods must be public. for implementing functionality

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is polymorphism

A

“as one interface, many implementations”. a characteristic of being able to assign a different meaning or usage to something in different contexts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

runtime polymorphism/dynamic method dispatch

A

a process in which a call to an overridden method is resolved at runtime rather than compile-time. an overridden method is called through the reference variable of a superclass. determination of the method to be called is based on the object being referred to by the reference variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

method overloading

A

methods of same class shares same name, but each method has dif parameters or dif signatures. compile time polymorphism.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

method overriding

A

subclass have same method with same name and exactly same signature. to change existing behavior of method in inheritance. run time polymorphism. DOESN’T WORK IF PARENT HAS STATIC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

can you override private or static method?

A

no since is not visible from other class. if you create similar method with same signature in child class then it’ll hide super class method (method hiding)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

multiple inheritance

A

where child class inherits property from multiple classes. problem with it is that if multiple parent classes have same method name, then at runtime it becomes difficult for compiler to decide which method to execute from child class. JAVA MULTIPLE INHERITANCE NOT SUPPORTED.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

instantiate

A

creates object with new

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

initialization

A

new with constructor initializes new object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

instantiate new object with new parameters

A

calls all constructors from down up

How well did you know this?
1
Not at all
2
3
4
5
Perfectly