File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Enthuware question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Enthuware question" Watch "Enthuware question" New topic
Author

Enthuware question

Daniel Martins
Ranch Hand

Joined: Oct 22, 2009
Posts: 45


According to the answer provided, answer 2 is correct but I don't think so...
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9321
    
  17

Both 1 and 2 looks like the correct answers to me, why do you think 2 is not the right answer??


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Daniel Martins
Ranch Hand

Joined: Oct 22, 2009
Posts: 45
exit without any output and exceptions if no arguments are given?

But no arguments means args.length=0 and will lead to arg[-1] bellow.

System.out.println(args[args.length-1]);

What did I miss?

Jack Bento
Ranch Hand

Joined: Jun 14, 2009
Posts: 34
Daniel Martins wrote: args.length=0 and will lead to arg[-1]


and that will throw the exception and output nothing
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enthuware question