9/10/2010

7 interview pointers on Java access control

    * The scope of an automatic variable is method scope and the member variable life is class level.
    * Protected features are available to class, subclass, within a package and only for subclasses in a different package.
    * If you don't specify an access modifier, then compiler assigns default access modifier, which is not a keyword.
    * A 'final' variable must be initialized at the point of declaration.
    * If define a class as final then the class cannot be extended (avoiding the inheritance).
    * An abstract classes cannot be instantiated. If you define one method as abstract in a class the class must be defined as abstract.
    * If you define one non default constructor in any given class, then the default constructor will not be provided by the compiler.

0 comments:

Post a Comment