Java Programming

H

hellzlilangel61

main method - public static void main (String [] args)

I want to know how i can add values to the string array arguments and
when I can do this....
 
A

Andrew Thompson

main method - public static void main (String [] args)

I want to know how i can add values to the string array arguments

1)
: from the CLI
java TheClass argument1 argument2 argument3

2)
// from Java code
String[] args = new String{
"argument1", "argument2", "argument3"
}
TheClass.main(args);
// + other ways..
..and
when I can do this....

1) at start-up
2) any time when called from within code.

Note also, that;
1) The word 'I' should always be Upper Case.
2) Asking more specific questions, encourages
more specific answers.
3) A good group for beginners is comp.lang.java.help.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
 
R

Roedy Green

I want to know how i can add values to the string array arguments and
when I can do this....

normally on the command line.

you say something like this

java.exe -jar thejar.jar rose daisy petunia

where the flowers appear as a String[3] array to main.

You can also call main just as you would any other static method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,792
Messages
2,569,639
Members
45,353
Latest member
RogerDoger

Latest Threads

Top