REGISTER FREE to Receive Instant Job

Friday, 7 November 2014

Why in Java main method return type void is used

Question : Why in Java main method return type void is used?


Figure 1 is compiler-based program which directly calls O/S functions during execution. So, here O/S returns some integer value to acknowledge that whether the application run successfully or not.

Figure 2 is interpreter-based program which is executed by JRE. Java application has no direct connectivity with O/S. It runs on JRE.

  • It is JRE who confirms that all bytecodes are valid and do not violate Java’s security restrictions. Any type of rule violation led to error(Compile time or runtime) by JRE.
  • Since JRE is boss of everything and itself capable to handle each type of error, it doesn’t expect anything to come back from main(), so we use void in main() method.


1 comment:

Popular Posts

Powered by Blogger.

About Me

My photo

JobsAcid is a 'job search engine' to provide finding a job on the internet easier for the user. It has designed as huge selection of job offerings on the same search engine.