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 Question about Java Operator 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 "Question about Java Operator" Watch "Question about Java Operator" New topic

Question about Java Operator

Marcos R Oliveira
Ranch Hand

Joined: Apr 20, 2002
Posts: 51
In Marcus Green's Mock Exam #570 the question was

And the given correct answers were 1, 2 and 3.
The explanation was that in the option 2 we have the ternary operator. Shouldn�t it be '?:' ?
Thanks for your help!

SCJP 1.4 - SCJP 1.6 - SCWCD in progress
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Yeah, it probably should have been ?:, not just ?.

SCJP Tipline, etc.
Darren McLeod

Joined: Jul 07, 2003
Posts: 19
Originally posted by Corey McGlone:
Yeah, it probably should have been ?:, not just ?.

The JLS says ? is an operator by itself and : is also an operator by itself. So just ? is valid.
Here is the reference:
JLS Operators

I agree. Here's the link:
subject: Question about Java Operator
jQuery in Action, 3rd edition