This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Chapter 10 Q1 in Kathy Book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Chapter 10 Q1 in Kathy Book" Watch "Chapter 10 Q1 in Kathy Book" New topic
Author

Chapter 10 Q1 in Kathy Book

Anurag Blore
Ranch Hand

Joined: Jan 15, 2003
Posts: 74
All,

The question no 1 is not clear in the chapter 10. It doesn't tell the class files are in different pacakages and If I assume the packagge is same my answer is different from the one given in book.

Do we get this type of questions in exam?? Or I have missed to read the question properly.

Thanks


Thanks,
Anurag
SCJP 1.2 & 1.5, PMP
Vishwanath Krishnamurthi
Ranch Hand

Joined: Jun 04, 2007
Posts: 331
Hi Anurag,

So, the question is:




Which statements are true? (Choose all that apply.)
A. The output is 0.
B. The output is 5.
C. The output is 6.
D. Compilation fails.
E. The code compiles if line 1 is removed.
F. The code compiles if line 2 is changed to read
Useful uuu = new Useful();


Answer:
3 D is correct. The increment() method must be marked public to be accessed outside of
the package. If increment() was public, C, E, and F would be correct.





I find, this pretty clear.. Note that there's a mention "in different files" and there's no package statement in the second class.. So it belongs to the default package.. not to the xcom package..

Regards,
Vishwa
[ January 19, 2008: Message edited by: Vishwanath Murthi ]

Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Chapter 10 Q1 in Kathy Book
 
Similar Threads
javac question from book unclear
Topics not covered in HFS&J
Operators
How to get ready for the SCJP 5???
technologies in the book