Hot Posts

Member’s Non-Access Modifiers

Below is a summary of the principle characteristic of the access and non-access modifiers.


final:


  • Prevents a method from being overridden.
  • A final argument cannot be overridden.


abstract:


  • Has no method body.Ends in semicolon and not {}
  • NEVER used with final, private, static
  • Only abstract classes or interfaces can contain abstract methods.
  • An abstract class can have non-abstract methods also it can have zero abstract methods.
  • All abstract methods must be implemented by subclasses unless the subclass is abstract.
  • Concrete class must implement all abstract methods.


synchronized:


  • Only applies to methods.
  • The method can be accessed by only one thread at a time.
  • Can be used with public, private, protected and package default


native:


  • Only applies to methods.
  • The method is implemented in platform-dependant code.
  • Has no code and ends with a semicolon.


strictfp:


  • Forces floating points to adhere to the IEEE754 standard.
  • Method can be strictfp even if class is not.


transient:


  • The JVM will skp this variable when serialising an object.
  • Applies only to instance variables.


Volatile:


  • Applies only to instance variables.

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: