Core Java - Interview Questions and Answers


  1. Why does Java not support operator overloading?
    Operator overloading makes the code very difficult to read and maintain. To maintain code simplicity, Java doesn't support operator overloading.
  2. Can we define private and protected modifiers for variables in interfaces?
    No.
  3. What is Externalizable?
    Externalizable is an Interface that extends Serializable Interface. And sends data into Streams in Compressed Format. It has two methods, writeExternal(ObjectOuput out) and readExternal(ObjectInput in)
  4. What modifiers are allowed for methods in an Interface?
    Only public and abstract modifiers are allowed for methods in interfaces.
  5. What is a local, member and a class variable?

    Variables declared within a method are "local" variables.

    Variables declared within the class i.e not within any methods are "member" variables (global variables).

    Variables declared within the class i.e not within any methods and are defined as "static" are class variables.

  6. What is an abstract method?
    An abstract method is a method whose implementation is deferred to a subclass.

« Prev   [ Page 10 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 |