my dog learned polymorphism*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question about Java Operator" Watch "Question about Java Operator" New topic
Author

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
Greenhorn

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


SCJP, SCBCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about Java Operator
 
Similar Threads
Can such a question be asked???
Jai Question : 1 on + operator
instanceof operator
related to operators
Stringbuffer as SQL string?