Core Java - Interview Questions and Answers


  1. Why is an Interface be able to extend more than one Interface but a Class can't extend more than one Class?
    Basically Java doesn't allow multiple inheritance, so a Class is restricted to extend only one Class. But an Interface is a pure abstraction model and doesn't have inheritance hierarchy like classes(do remember that the base class of all classes is Object). So an Interface is allowed to extend more than one Interface.
  2. Can an Interface be final?
    Not possible. Doing so so will result in compilation error.
  3. Can a class be defined inside an Interface?
    Yes it's possible.
  4. Can an Interface be defined inside a class?
    Yes it's possible.
  5. What is a Marker Interface?
    An Interface which doesn't have any declaration inside but still enforces a mechanism.
  6. Which object oriented Concept is achieved by using overloading and overriding?
    Polymorphism.

« Prev   [ Page 9 of 22  Jump... Next »

Jump to page : 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |