Home
11.
What is the purpose to use nested types in java ?

Nested types are used for two separate purposes, that are related to encapsulations

A type may be nested because it needs especially intimate access to the internals of another type by being a member type, it has access in the same way that member variables and methods do, and can bend the rules of encapsulation.

A type may be only required for a very specific reason, and in a very small section of code. It should be tightly localized, as it is really part of the implementation detail and should be encapsulated away from the rest of the system.

12.
What is Polymorphism ?

Polymorphism means that one object can take the form, or place of, an object of a different type. Polymorphism can exist when one class inherits another. It can also exist when a class implements an interface.

13.
What is Static member types ?

A static member typeis much like a regular top-level type.however, it is nested within the namespace of another type.

14.
Tell me the difference between a queue and a stack?

Queues are working by First in First Out (FIFO) rule but the stacks are working by Last in First Out (LIFO) rule.

15.
Can we use abstract classes instead of interfaces?

Yes sometimes we can use but the class may be a descendant of another class also in this case the interface is the only option.