Java Programming: Why do we have main method ? can this method name be changed ?

balamt/ October 27, 2019/ How-To, Interview, Java/ 0 comments

I was wondering always, why it is always main method is the starting point for the Java program.

Well When i was matured enough to read the Java Specification i learnt why and whether can it be changed ? Okay Lets See !!

Why main method ?

Main method is the starting point for the java program, JVM initialize the class and invokes main method, having below listed specifications (reference 12.1.4). 

  • Should be named as main 
  • Should be public 
  • Should be static 
  • Should accept String array as argument. 
  • Return type is void 

As based on the above specification, we can conclude that we cannot rename the main method. 

Some Additional Info.!

Share this Post

Leave a Comment