static variable (also known as class variable)

Java Programming Language Class, Object and Methods in java (Article) Class, Object and Methods in java (Program)

920

Program:

 //Program of static variable
class StudentClass{

// static variable or class variable
   static String SubjectName ="Java Programming Language";

 public static void main(String args[]){

  System.out.println(SubjectName);
 }
}

/*
No need to create object in same class
If you declare any variable as static, it is known static variable.
The static variable gets memory only once in class area at the time of class loading.
It makes your program memory efficient (i.e it saves memory).
*/

Output:

Java Programming Language
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.