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.


2 comments:

  1. Our digital marketing course in Chennai is targeted at those who are desirous of taking advantage of career opportunities in digital marketing. Marketing professionals who are presently using traditional marketing to meet their business objectives. Start-ups, Entrepreneurs, Business Owners who desire to make use of online media to improve their business goals and objectives.
    Digital Marketing Course in Chennai
    Digital Marketing Training in Chennai
    Online Digital Marketing Training
    SEO Training in Chennai

    ReplyDelete

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.