Java Modifiers

In the Java it is possible to modify classes, methods, etc., by using modifiers. There are two categories of modifiers:

  1. Access Modifiers: default, public , protected, private








     
            Java provides a number of access modifiers to set access levels for                   classes, variables, methods and constructors. 
            The four access levels are:
  •         Visible to the package, the default. No modifiers are needed.
  •         Visible to the class only (private).
  •         Visible to the world (public).
  •         Visible to the package and all subclasses (protected).


   2. Non-access Modifiers: static, final, abstract, synchronized,volatile.



                 Java provides a number of non-access modifiers to achieve many other             functionality.     
               The non-access modifier are of six types:

  •               The static modifier for creating class methods and variables
  •             The final modifier for finalizing the implementations of classes,                   methods, and variables.
  •             The abstract modifier for creating abstract classes and methods.
  •             The synchronized and volatile modifiers, which are used for threads.

Comments

  1. Very well explained article on java modifiers, as a java beginner its very good to know in detail on java modifiers it will be helpful in clearing all concepts as you have shared very useful and insightful article here. Thanks a lot!

    ReplyDelete

Post a Comment

Popular posts from this blog

Operating System | Best Definition of Opetating System

Umbrella activities in Software Engineering