| Author |
when args.length is checked whats the output?
|
kavitha yogaraj
Greenhorn
Joined: Apr 21, 2010
Posts: 19
|
|
This program was there in www.javachmp.com java test
when I executed this program I had no output
but the output in the exam result is onetwo--
the explaintation is
Be careful of the braces, the System.out.print("--") is not included in the for loop block, so it will be executed once after the loop is finished
java Tester one two
The first argument represents the name of the class, and what come after are the program arguments.
|
 |
Jim Hoglund
Ranch Hand
Joined: Jan 09, 2008
Posts: 525
|
|
Isn't CommandLineTest the name of your class?
Jim ... ...
|
BEE MBA PMP SCJP-6
|
 |
kavitha yogaraj
Greenhorn
Joined: Apr 21, 2010
Posts: 19
|
|
Jim Hoglund wrote:Isn't CommandLineTest the name of your class?
Jim ...  ...
yes, it is the name of my class.
|
 |
Jim Hoglund
Ranch Hand
Joined: Jan 09, 2008
Posts: 525
|
|
So what happens when you run "java CommandLineTest one two" ?
Jim ... ...
|
 |
kavitha yogaraj
Greenhorn
Joined: Apr 21, 2010
Posts: 19
|
|
Jim Hoglund wrote:So what happens when you run "java CommandLineTest one two" ?
java CommandLineTest one two" -> this is not what i run.
c:\java\javac Commandline is what I run One two i the output
|
 |
Justin Rundle
Ranch Hand
Joined: Mar 26, 2008
Posts: 123
|
|
What Jim is trying to say is that instead of running:
Should you not be running this instead:
Typo... or copy/paste error?
|
 |
Abimaran Kugathasan
Ranch Hand
Joined: Nov 04, 2009
Posts: 2066
|
|
|
Kavitha, => CarefullyChooseOneForum <= and => UseCodeTags <=. What is your question?
|
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
|
 |
Justin Rundle
Ranch Hand
Joined: Mar 26, 2008
Posts: 123
|
|
|
I am in the right forum and I was responding to the post and I did choose the right tags... why dont you read the whole thread first before posting you reply...
|
 |
Abimaran Kugathasan
Ranch Hand
Joined: Nov 04, 2009
Posts: 2066
|
|
Justin Rundle wrote:I am in the right forum and I was responding to the post and I did choose the right tags... why dont you read the whole thread first before posting you reply...
Addressed to Kavitha....
|
 |
Justin Rundle
Ranch Hand
Joined: Mar 26, 2008
Posts: 123
|
|
Abimaran Kugathasan wrote:
Justin Rundle wrote:I am in the right forum and I was responding to the post and I did choose the right tags... why dont you read the whole thread first before posting you reply...
Addressed to Kavitha....
Apologies.
|
 |
Abimaran Kugathasan
Ranch Hand
Joined: Nov 04, 2009
Posts: 2066
|
|
Justin Rundle wrote:
Apologies.
Again => NoNeedToSaySorry <=. Thanks for caring!
|
 |
 |
|
|
subject: when args.length is checked whats the output?
|
|
|