This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Declaration and Access control question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Declaration and Access control question" Watch "Declaration and Access control question" New topic
Author

Declaration and Access control question

Matt Ghiold
Ranch Hand

Joined: Feb 24, 2002
Posts: 213
Question ID :952739447900
[TRIAL]
Given the following program, which statment is true?
class SomeClass
{
public static void main( String args[ ] )
{
if (args.length == 0 )
{
System.out.println("no arguments") ;
}
else
{
System.out.println( args.length + " arguments.") ;
}
}
}
Ok, the answer according to J+ is that this
program will throw a null pointer exception at
runtime, but when I compile and run this class
exactly as is, I get no arguments printed.
Can someone please confirm if I am correct or not?
Thanks,
Matt


-Matt<br /> SCJP2<br /> SCJD
Rajinder Yadav
Ranch Hand

Joined: Jan 18, 2002
Posts: 178
Matt, if you can compile and run a java program then you already have your answer


<a href="http://www.rajindery.com" target="_blank" rel="nofollow">Rajinder Yadav</a><p>Each problem that I solved became a rule which served afterwards to solve other problems. --Rene Descartes
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Declaration and Access control question