Java Modifier Types


Modifiers are keywords that you insert into those descriptions to alter their meanings. Java language has a broad variety of modifiers, counting the following −

To employ a modifier, you comprise its keyword in the meaning of a class, technique, or changeable. The modifier heads the relaxation of the declaration, as in the following example.


public class className {
   // ...

private boolean myFlag;
static final double weeks = 9.5;
protected static final int BOXWIDTH = 42;

public static void main(String[] arguments) {
   // body of method

Access Control Modifiers

Java gives a number of admission modifiers to set contact levels for classes, variables, ways, and constructors. The four entrée levels are −

  • Observable to the package, the default No modifiers are required.
  • Noticeable to the private class
  • Perceptible to the public class Evident and protected to the package and all subclasses

Non-Access Modifiers

  • Java gives a number of non-access modifiers to attain numerous other functionality
  • The still modifier for creating class ways and variables
  • The concluding modifier for finalizing the executions of classes, processes, and variables
  • The conceptual modifier for developing conceptual classes and process
  • The coordinated and unstable modifiers, which are utilized for threads

Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.