Basic HTML version of Foils prepared 18 May 97

Foil 19 Java Language -- Expressions

From Java Tutorial - Spring 1997 Part II: Java Language and Object-Oriented Concepts Peking Tutorial, Web Certificate -- Spring-Summer 1997. by Nancy J. McCracken,Geoffrey C. Fox


1 Java's expressions are very similar to C and the following are valid:
2 2+3
3 (2+3)*i
4 i++ /* equivalent to i = i +1 */
5 (i > 0 ) && (j>0) /* Boolean */
6 i <<1 /* Left shift by 1 binary digit */
7 (i>0) ? true:false /* conditional expression */
8 i >>> 2 /* Signed right shift by 2 binary digits */
9 "fred" + "jim" is "fredjim"
10 /* + Equivalent to . in Perl */
11 (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 Thu Jan 8 1998