HELP! * GREY=local LOCAL HTML version of Foils prepared July 10 1996

Foil 49 Java Language -- Variable/Expression Types

From Basic Lectures on Java Language Applets Graphics Networking Trip to China and Icase Tutorial -- July 12-28 and June 10-13 96. by Geoffrey C. Fox * See also color IMAGE

Each Java variable or expression has a definite type. There are three "types" of types!
  • There are Primitive or Simple types such as integers or booleans which are built-in.
  • New composite types (objects) can be constructed in terms of classes and interfaces. The type of an object is its class or interface
  • Arrays we will see are a sort of "almost" object!
First we discuss the Primitive Types
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 standard.
Characters are given by 16bit Unicode charset and represented as short integers.
One can use casts such as longint = (long) i; // which can be explicit as here and sometimes implied (see later)
Note booleans are either TRUE or FALSE -- they are not 0, 1 ,-1 ...



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 Tue Feb 18 1997