wood burning stoves*
The moose likes Beginning Java and the fly likes Signature of main Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Signature of main" Watch "Signature of main" New topic
Author

Signature of main

Sham Grandhe
Ranch Hand

Joined: Dec 16, 2003
Posts: 73
hai friends,

what is the significance of the String arguments in the main method?
some please do give me a detailed explanation for this.
if possible give some demo.

thanking you

with regards
shyam kumar
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
You pass through this String array the arguments from the command line.
If you start a class like this java MyClass hello
and your main is defined
public static void main(String args[])

then args[0] contains the string "hello".


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
navneet shrivastava
Ranch Hand

Joined: Jul 09, 2004
Posts: 39
Also, in sm of the application we need to compile sm java files [say if any modification is detected]. It may be req. to pass sm parameter to that utitlity/ application at runtime.
But I belive it is much more that this!!
-navneet


+nav
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
If you are not too read this.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Signature of main
 
Similar Threads
static block
Not able to find .dll file in my java path
Why do we give "String [] args" as an argument to main??
Tapestry refrence needed
mock exam question