Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Ternary operator

 
Richard Wilson
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,can anyone tell whether the Ternary operator
(?: ) does a full evaluation or a partial evaluation to the operands.
[ February 10, 2002: Message edited by: Richard Wilson ]
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following link may be of help:
JLS 15.25 Conditional Operator ? :
Amazing how a simple piece of code can be of tremendous help

Output: 10,2,3,40
which means only the relevant operand is evaluated
HIH
[ February 10, 2002: Message edited by: Valentin Crettaz ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic