Java Modifier Types

Java Modifier Types

Posted in : Core Java Posted on : September 28, 2010 at 12:39 PM Comments : [ 0 ]

This section contains the types of modifier in java

Java Modifier Types

A modifier is a keyword placed in a class, method or variable declaration that changes how it operates.

Java has long list of modifiers. Given below the two categories of access modifier :

  • Java Access Modifier

  • Non Access Modifier

Java Access Modifier

Java has a number of access modifier to control access for classes, variables, methods and constructors. Following are the four types :

  • default - No need of access modifier, It is automatically visible to the package.

  • private - It is used to set the visibility to class level.

  • public - for setting visibility inside and outside package.

  • protected - for setting visibility to the package and all subclasses 

Non Access Modifiers :

  • Java has a variety of non access modifier, some are given below :

  • The static modifier is used to create static class methods and variables.

  • The final modifier is used to prevent variables from being modified. It behaves like constant. It is also used to prevent overloading and inheritance.

  • The abstract modifier is used to create abstract classes and methods.

  • The synchronized and volatile modifiers are used for threads.

Go to Topic «PreviousHomeNext»

Your Comment:

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image

Tutorial Topics