Modifier's, Variable's in Java.

Modifier's in Java-
Modifier's are keywords that you add to those defination's to change, modify or specify their meaning there are two major types of modifiers in java.
  1. Access
  2. Non-access
Access modifiers are-
Public- Visible to all.
Private- visible to class only.
Protected- Visible to the package and all sub-class.
Default- Visible to the package.

Non-access modifier are-
Static-
The static modifier for calling methods and variables without an object to which it belongs.

Final-
The final modifier for finalizing the implementation of classes ,methods and variables.

Abstract-
Abstract modifier for creating abstract classes and methods.

Synchronized and volatile-
The synchronized and volatile modifiers which are used for threads. 

Variable's-

  • Variables are memory locations which are reserved to store values.
  • This implies while declaring a variable you reserve some memory.
  • when you want to use a variable in a program, we should declare it.
        int x;
  • Here we declare variable x, which can store integer type data.

Comments

Popular posts from this blog

What is C# ?

Communication Skills

7 Habits of Highly Effective People Book Summary