Static Keyword
Thestatic keyword is used for memory management mainly. It applies to variables, methods, blocks, and nested classes.Static Variable: Gets memory only once in the class area at the time of class loading. Shared among all objects.
Static Method: Belongs to the class rather than the object of a class. Can be invoked without creating an instance of a class.
class Student {
int rollno;
String name;
static String college = "ITS"; // static variable
static void change() { // static method
college = "BBDIT";
}
}