GeeCON Prague 2014*
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


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "k&b page 312" Watch "k&b page 312" New topic
Author

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!
 
GeeCON Prague 2014
 
subject: k&b page 312