shivang sarawagi wrote:fred i compiled and checked main method without any parameter is not compiling. JVM throws an error.
Exception in thread "main" java.lang.NoSuchMethodError: main
Jitendra Jha wrote:
Why did they(creators of java) made it compulsory for main to have an argument.....
What advantage does it(making it compulsory) give us.
Even if she did not ask it,this question has perflexed me too, so kindly help me understand it.
Fred wrote:That's because when you try and run a class, the JVM explicitly looks for a method with the signiature of "public static void main (String  args)".
Maneesh Godbole wrote:Fred has already answered it above