0 votes
Why do we write public static void main?

1 Answer

+1 vote
The main method must be public so it can be found by the JVM when the class is loaded. Similarly, it must be static so that it can be called after loading the class, without having to create an instance of it. All methods must have a return type, which in this case is void.