File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes public static void main(String agrs[]) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "public static void main(String agrs[])" Watch "public static void main(String agrs[])" New topic
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: 38040
    
  22
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: public static void main(String agrs[])
 
Similar Threads
First GUI program
WA #1.....word association
java.lang.NoSuchMethodError
run time error
packaging runme.jar