Basic HTML version of Foils prepared Sept 6 1998

Foil 10 Java Language -- Expressions

From Java Tutorial 98-2: Java Language and Object Oriented Techniques CPS606 Fall Semester 1999 -- Sept 7 1999. by Geoffrey C. Fox, Nancy McCracken


1 Java's expressions are very similar to C and include the following forms. Both expressions and statements have values.
  • arithmetic:
    • 2+3
    • (2+3)*i
  • autoincriment and autodecriment
    • i++ /* equivalent to i = i +1 */
  • boolean
    • ((i > 0 ) && (jɬ)) ||(state = -1)
  • bit operations
    • i <ə /* Left shift by 1 binary digit */
  • conditional expression
    • (iɬ) ? expression1 : expression2
  • strings have operators such as catenation
    • "fred" + "jim" is "fredjim"
  • object property operators
    • (a instanceof B) /* True iff object a is of class B */

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Mon Sep 6 1999