Static Method in Java tccicomputercoaching.com The static keyword in Java is used for memory management mainly. If you apply static keyword with any method, it is known as static method.
All the instance of the class share the same copy of the variable, a static variable can be accessed directly by calling â&#x20AC;&#x153;<<ClassName>>.<<VariableName>>â&#x20AC;? without need to create instance for the class. class Student{ int rollno; String name; static String college = "ITS"; //static method to change the value of static variable static void change(){ college = "BBDIT"; } //constructor to initialize the variable Student(int r, String n){