This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes k&b page 312 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "k&b page 312" Watch "k&b page 312" New topic

k&b page 312

Allen Bandela
Ranch Hand

Joined: Feb 16, 2006
Posts: 128

is'nt there a mistake on page 313 of K&B SCJP5?
Specifically the program with fragments. Isnt the output 41? or i'm missing something?
Loveen Jain
Ranch Hand

Joined: Jan 24, 2004
Posts: 35

I think you are talking about this code right?

Answer is certainly 4 2.

Reason :
a) First print statement : 14 % 5 = 4 ( is the remainder after divison of 14 by 5)
b) Second print statement : 7 % 5 = 2 ( is the remainder after divison of 7 by 5).

I hope its clear!
subject: k&b page 312
Similar Threads
is why is this question contradicting what k&B says?
Doubt regarding static context
Anonymous inner classes
K&B page 448 Question on GC
Doubt in protected access