Short Answer type Questions

1. What do you mean by polymorphism?
Polymorphism – means the ability of a single variable of a given type to be used to reference objects of different types, and automatically call the method that is specific to the type of object the variable references.

2. Give the benefit of polymorphism?
The benefit of polymorphism is that it is very easy to add new classes of derived objects without breaking the calling code (i.e. getTotArea() in the sample code shown below) that uses the polymorphic classes or interfaces.

3. What do you mean by Inheritance?
Inheritance – is the inclusion of behavior (i.e. methods) and state (i.e. variables) of a base class in a derived class so that they are accessible in that derived class.

4. What do you mean by Encapsulation?
Encapsulation – refers to keeping all the related members (variables and methods) together in an object. Specifying members as private can hide the variables and methods.

5. What are the benefits of the Java collection framework?
Collection framework provides flexibility, performance, and robustness.
1. Polymorphic algorithms – sorting, shuffling, reversing, binary search etc.
2. Set algebra - such as finding subsets, intersections, and unions between objects.
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: