+ 1

If "main" is also method and "sayhello()" is also a method then why we consider "sayhello()" under "main" ?

from learn java

30th Oct 2016, 8:50 AM
Aurum Titan
Aurum Titan - avatar
2 ответов
+ 1
Just consider main as a main door and sayhello as a door_1 In order to enter into door_1 you first need to enter main door main method in Java is an standard method which is used by JVM to start execution of any Java program. main method is referred as entry point of Java application which is true in case of core java application but in case of container managed environment like Servlet, EJB or MIDlet this is not true as these Java programs have there own life-cycle methods like init(), service() or destory() for Servlet's which is used by container. main method in Java is run by main thread which is a non daemon thread and Java program runs until main method finishes or any other user thread is running. When we start JVM by running java command we also provide name of class which contains main method, which is later invoked by JVM to start Java program execution Read more: http://www.java67.com/2012/08/what-is-main-method-in-java-why-main-is.html#ixzz4OaFwRhBq
30th Oct 2016, 3:44 PM
மனோஜ்குமார் பழனிச்சாமி
மனோஜ்குமார் பழனிச்சாமி - avatar
0
A "main()" method is the starting point of every Java program a Java program won't run without a "main()" method. Every other method can be written out of the main method then call in the main method to be executed.
30th Oct 2016, 8:59 AM
Tech Go
Tech Go - avatar