Monday, March 30, 2009

Java Modifiers

• Final class cannot be extended.
• Final method cannot be overridden.
• Final attribute
– must be initialized in class or constructor.
– once it is given a value, it cannot be changed.
– final object variable, it is the reference that cannot be changed not its value.
• Abstract class cannot be instantiated.
• Abstract method must be defined in abstract class, but abstract class may
contain non-abstract method.
• Abstract method cannot implement method body.
• Abstract never matches with final, only with protected and public.
• Local variable cannot be defined as static
• Static method cannot overridden non-static method and vice versa.
• Static methods are not allowed to use a non-static feature of their class, but not
vice versa.

No comments: