Core Java - Interview Questions and Answers


  1. What is the importance of static variable?
    static variables are class level variables where all objects of the class refer to the same variable. If one object changes the value then the change gets reflected in all the objects.
  2. Can we declare a static variable inside a method?
    Static varaibles are class level variables and they can't be declared inside a method. If declared, the class will not compile.
  3. What is an Abstract Class and what is it's purpose?
    A Class which doesn't provide complete implementation is defined as an abstract class. Abstract classes enforce abstraction.
  4. Can a abstract class be declared final?
    Not possible. An abstract class without being inherited is of no use and hence will result in compile time error.
  5. What is use of a abstract variable?
    Variables can't be declared as abstract. only classes and methods can be declared as abstract.
  6. Can you create an object of an abstract class?
    Not possible. Abstract classes can't be instantiated.

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