Basic HTML version of Foils prepared May 12 1996

Foil 41 Java Language -- Variable/Expression Types

From CRPC Lectures on Java Language Applets Graphics CRPC Annual Meeting Tutorial -- May 14,1996. by Geoffrey C. Fox


Each Java variable or expression has a definite type. Simple types such as integers or booleans are built-in. New composite types can be constructed in terms of classes, arrays and interfaces.
  • Note booleans are either TRUE or FALSE -- they are not 0, 1 ,-1 ...
There are 4 integer types: byte, short, int, long of size 8, 16, 32 and 64 bits, respectively.
Float is 32 bits, double is 64 bits. Floating point arithmetic and data formats are defined by IEEE754.
Characters are given by 16bit Unicode charset and represented as short integers.
One can use casts such as longint = (long) i;
Arrays are "true" or "first class" objects in Java and no pointer arithmetic is supported. Hence, arrays are handled as all other composite objects and its special role is due only to some syntactic sugar inherited from C/C++.



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