Java   View all facts   Glossary   Help
syntactic unit > expression > conditional operator expression
Next expressionnumeric expression    Upexpression    Previous expressioncompound expression   

conditional operator expression
subjectfact 
conditional operator expressionhas example
//Print the value of change and "minute" or minutes" depending if change equals 1 or not
System.out.println((change == 1) ? "minute" : "minutes")
added by: JK, source: On To Java, 2001-10-19 11:36:31.0
has syntax
(boolean expression) ? if-true expression : if-false expression
added by: JK, source: On To Java, 2001-10-19 11:36:31.0
is a subtopic of Statements and Expressions2001-10-19 11:36:31.0
is a kind of expressionadded by: JK, source: On To Java, 2001-10-19 11:36:31.0
produces a value which is the value of the selected expressionadded by: JK, source: On To Java, 2001-10-19 11:36:31.0
expressioncan be part of an expression2001-10-19 11:36:41.0
has type that is the type of its result2001-10-19 11:36:42.0
has value called its result, or its return value2001-10-19 11:36:42.0
has purpose
  • to compute values
  • or to assign to a variable
  • or to control the flow of execution
2001-10-19 11:36:42.0
occurs in a context where a value is required2001-10-19 11:36:42.0
performs a computation specified by 0 or more operators2001-10-19 11:36:42.0
returns a value from its computation2001-10-19 11:36:42.0
syntactic unithas syntax rule
bold = mandatory
italic = non-terminal
normal font = optional
2001-10-19 11:38:04.0