File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Declaration and Access control question" Watch "Declaration and Access control question" New topic

Declaration and Access control question

Matt Ghiold
Ranch Hand

Joined: Feb 24, 2002
Posts: 213
Question ID :952739447900
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") ;
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?

-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="" 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:
subject: Declaration and Access control question
It's not a secret anymore!