Java — Guess what happens if we remove “static” from main() method?
Any basic programmer starts with coding creating a main() method and we just strart writing public static void main(String[] args)
Have you ever thought or run a program by removing the keyword static.
I just tried running the program by removing the static keyword. Here is the error:
Error: Main method is not static in class com.javasample.basicjava,
please define the main method as:
public static void main(String[] args)
So, why is this error? What happens internally?

we know that when we make a method as static, it belongs to the class and so no object is required to call this method. This method can be directly accessed via classname
Now if we remove the static keyword from the main() method, there will be no compilation error. But when it starts running the code, JVM loads the class into memory and tries calling the main() method which cannot happen as it is not static, it is not present in the class memory. JVM cannot find the main() method.
Therefore, it throws run time error.