Java   View all facts   Glossary   Help
syntactic unit > expression
Next syntactic unitkeyword    Upsyntactic unit    Previous syntactic unitdefinition   

expression comparison table
Subject have syntax have example has definition have purpose produce have have type is a subtopic of is a synonym of
array access expression myArray[1] 
  • to compute values
  • or to assign to a variable
  • or to control the flow of execution
  that is the type of its resultArrays 
assignment expression (x = 1) * 2 (with no ;)An expression that contains an assignment operatorto assign to a variable  that is the type of its resultStatements and Expressions 
boolean expression x < y & z > 1An expression that produces a true or false result
  • to compute values
  • or to control the flow of execution
  booleanStatements and Expressions 
cast expression (int)5.2 to convert an expression of one type into another type  that is the type of its resultObjects 
compound expression 
x * y * z
An expression made up of two or more expressions
  • to compute values
  • or to assign to a variable
  • or to control the flow of execution
 evaluation order based on the precedence of its operand sthat is the type of its resultStatements and Expressions 
conditional operator expression
(boolean expression) ? if-true expression : if-false expression
//Print the value of change and "minute" or minutes" depending if change equals 1 or not
System.out.println((change == 1) ? "minute" : "minutes")
 
  • to compute values
  • or to assign to a variable
  • or to control the flow of execution
a value which is the value of the selected expression that is the type of its resultStatements and Expressions 
numeric expression x + y 
  • to compute values
  • or to assign to a variable
  • or to control the flow of execution
  that is the type of its resultStatements and Expressionsarithmetic expression
object creation expression  An expression that creates a new objectto create a new object  that is the type of its resultObjects 

Next syntactic unitkeyword    Upsyntactic unit    Previous syntactic unitdefinition