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


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.
int x, y, z ;
x = 2 ;
y = 3 ;
z = ( int ) Math.pow ( x, y ) ;



© 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