Q) Java object oriented programming concepts is/are
- Encapsulation
- Inheritance
- polymorphism
- All of the above.
Answer: 4
Q) Java does not support _______________?
- Inheritance
- Multiple inheritance for classes
- multiple inheritance of interfaces
- compile time polymorphism
Answer: 2
Java does not support multiple inheritance for classes but in java multiple inheritance behavior is implemented using interfaces.
Q) Runtime polymorphism feature in java is
- method overriding
- method overloading
- constructor overloading
- operator overloading
Answer: 1
Since in method overriding both the classes(base class and child class) have same method, compile doesn’t figure out which method to call at compile-time. In this case JVM(java virtual machine) decides which method to call at runtime that’s why it is known as runtime or dynamic polymorphism.
Q) Encapsulation concept in java is
- Hiding complexity
- method hiding
- Hiding constructor
- None
Answer: 1
Q) Following concept can be used for encapsulation in java programs
- Wrapping data fields with methods
- Hiding data and internal methods using access modifiers in a class
- Using Interfaces
- All of the above
Answer: 4
Encapsulation means, hiding the complexities in java programs. All options above are used to implement encapsulation in java object oriented programming.