Basic HTML version of Foils prepared Feb 19 1999

Foil 14 Type Conversions

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


1 You can use the Math methods on values of type int as well, but to get back an int result, you must convert the result by putting the type you want in ( ). This is called casting.
2 int x, y, z ;
3 x = 2 ;
4 y = 3 ;
5 z = ( int ) Math.pow ( x, y ) ;

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