News Ticker

Final Class


Access Modifiers


Access modifiers: package-default, public
Non-access modifiers: final (cannot be abstract)


Constructors


Access modifiers: private, package-default, protected, public
Non-access modifiers: none are allowed

  • No return type allowed.


Blocks


Access modifiers: package-default
Non-access modifiers: static or none


Members


Access modifiers: private, package-default, protected, public
Non-access modifiers: static, final, transient, volatile,  synchronized

  • If final must be initialized and cannot be volatile.


Methods


Access modifiers: private, package-default, protected, public
Non-access modifiers: static, final, native, strictfp, synchronized

native:

  • Cannot have body code, looks like abstract method e.g. public native void method();
  • Must have return type void;
  • Cannot be strictfp;
  • Can have any other access and non-access modifier type.

Methods cannot be abstract, only abstract classes and interfaces can have abstract methods.


Behaviours


  • Cannot be subclasses (extends) nor implemented. The class is final.
  • Can implement one or more interfaces: has to implement all interfaces methods.
  • Can extend only one class: inherits methods and members which can be overridden.
  • If it extends an abstract class it must implement all abstract methods.

1 Trackback / Pingback

  1. Welcome « alex.theedom

Leave a Reply