| Author |
public static void main(String agrs[])
|
minal silimkar
Ranch Hand
Joined: Nov 25, 2007
Posts: 133
|
|
|
java main() method is in which class?
|
Minal Silimkar
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
It is in whichever class you put it in A Java application needs a main method to start. This is the interface the Java runtime uses to call into your code.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Piyush Porwal
Ranch Hand
Joined: Apr 09, 2008
Posts: 30
|
|
|
or what he means to say is: if you fire "java ClassName", ClassName should have this.
|
-Piyush Porwal (Junk box)
|
 |
minal silimkar
Ranch Hand
Joined: Nov 25, 2007
Posts: 133
|
|
Originally posted by Paul Sturrock
It is in whichever class you put it in A Java application needs a main method to start. This is the interface the Java runtime uses to call into your code.
Thank you Paul. I thought, main() is necessary to run the program, so it must me somewhere mentioned in bulit-in classes
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32675
|
|
Originally posted by minal silimkar: Originally posted by Paul Sturrock Thank you Paul. I thought, main() is necessary to run the program, so it must me somewhere mentioned in built-in classes
No, none of the built-in classes has a main method, because none of the built-in classes is designed as the starting point for an application. You write a class which starts off your application, and you write a main method for the JVM to start with.
|
 |
minal silimkar
Ranch Hand
Joined: Nov 25, 2007
Posts: 133
|
|
Originally posted by Campbell Ritchie No, none of the built-in classes has a main method, because none of the built-in classes is designed as the starting point for an application. You write a class which starts off your application, and you write a main method for the JVM to start with.
Thank you Campbell, for detailed explaination.
|
 |
 |
|
|
subject: public static void main(String agrs[])
|
|
|