xxxxxxxxxx
public class Main {
public static void main(String[] args) {
// Code to be executed when the program starts
}
}
xxxxxxxxxx
Because the object is not required to call the static method.
If we make the main method non-static,
JVM will have to create its object first and then call main() method which
will lead to the extra memory allocation.
xxxxxxxxxx
Use a static method
when you want to be able to access the method
without an instance of the class