Basic HTML version of Foils prepared Feb 19 1999

Foil 16 More on conditions

From Computing and Java Language Basics NPAC Java Academy February--April 99 -- Feb 13 1999. by Nancy McCracken


1 To test if two things are equal, for most types:
2 Other tests for int and double types:
3 To test if two strings have the same value:
4 int num;
5 if ( num == 0 ) ... value of num is 0
6 ( num != 0 ) value of num is not 0
7 ( num < 0 ) value of num is less than 0
8 ( num <= 0 ) value of num is less than or = 0
9 ( num > 0 ) value of num is greater than 0
10 . . . and so on
11 String label;
12 if ( label.equals ("enter") ) value of label is "enter"

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 Jul 5 1999