This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes when args.length is checked whats the output? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "when args.length is checked whats the output?" Watch "when args.length is checked whats the output?" New topic
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: when args.length is checked whats the output?
 
Similar Threads
Explain me please
operators
Command Line
Strange output
Question on Array