• Post Reply Bookmark Topic Watch Topic
  • New Topic

understanding the main method  RSS feed

 
shantanu kaushik
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have learned that we can declare the main method as "public static void main(String... args)"
I am not able to understand this way of making object of String class...
please discuss..
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you confused about the varargs notation String...?
Have a look here for details about what this notation implies and what its restrictions are.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String[] args and String ... args are same to Java Compiler . the later one is just a syntactic sugar.
 
Chetan Sarnad
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shantanu kaushik wrote:I have learned that we can declare the main method as "public static void main(String... args)"
I am not able to understand this way of making object of String class...
please discuss..


What to you want to discuss on?
Varargs in java or String class?
varargs can take any number of parameters. So, you can input the String array as command line arguements.
 
shantanu kaushik
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What to you want to discuss on?
Varargs in java or String class?
varargs can take any number of parameters. So, you can input the String array as command line arguements.


I want to know about the java varargs as i until now did not know about it..
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shantanu kaushik wrote:I want to know about the java varargs as i until now did not know about it..

In that case, try the link Jelle posted. There's also some information in the Java tutorials - see the section "Arbitrary Number of Arguments".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!