• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Signature of main

 
Sham Grandhe
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 724
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
navneet shrivastava
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are not too read this.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic