Basic HTML version of Foils prepared May 12 1996

Foil 43 Java Language -- Expressions

From CRPC Lectures on Java Language Applets Graphics CRPC Annual Meeting Tutorial -- May 14,1996. by 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 /* Boolean */
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 Sun Dec 14 1997