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 Boxing confuses 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 "Boxing confuses" Watch "Boxing confuses" New topic

Boxing confuses

Senthil Kumaran
Ranch Hand

Joined: Aug 24, 2008
Posts: 32
hi, somebody explain me this program, especially line 9, this question from Inquisition scjp6 trail set mock exam,

the answer is {aaa=2,bbb=1,ccc=1}

is that question mark in line 9 is printing mistake, if it is, i cant understand that boxing & unboxing clearly,

(Jesper Young: Corrected code tags)
Paul Stat
Ranch Hand

Joined: Jan 20, 2009
Posts: 50
I suggest you look up the "ternary" operator again
marc weber

Joined: Aug 31, 2004
Posts: 11343

Please do not cross post.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15092

Locked the topic in the Beginner forum, since this is a question that's relevant to SCJP.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Stephen Davies
Ranch Hand

Joined: Jul 23, 2008
Posts: 352
I think within your ternary statement you need to put ... ...otherwise it won't compile.

be a well encapsulated person, don't expose your privates, unless you public void getWife()!
Byju Joy
Ranch Hand

Joined: Sep 06, 2005
Posts: 84
M in TreeMap and S in System gotta be in CAPS.

I agree. Here's the link:
subject: Boxing confuses
It's not a secret anymore!