Main method

A collection of 1 post

Why Main method in java is static?

The method is static because otherwise there would be ambiguity: which constructor should be called? Especially if your class looks like this: Should the JVM call new JavaClass(int)? What should it pass for x? If not, should the JVM instantiate JavaClass without running any constructor method? I…

LearnPainLess On Instagram

Get The Best Of All Hands Delivered To Your Inbox

Subscribe to our newsletter and stay updated.