• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Chapter 10 Q1 in Kathy Book

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic