Hot Posts

Classes


Access Modifiers


Access modifiers: package-default, public
Non-access modifiers: final, abstract, or none (not obligatory)


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

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


  • 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, unless this class is also abstract. Non-abstract methods and members are inherited.

1 Trackback / Pingback

  1. Welcome « alex.theedom

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: