HELP! * YELLOW=global GREY=local Global HTML version of Foils prepared 1 February 97

Foil 40 Java Language -- Variable/Expression Types

From Jan 22 Delivered Lecture for Course CPS616 -- Java Lecture 1 -- Overview CPS616 spring 1997 -- Jan 22 1997. by Nancy McCracken * See also color IMAGE
Secs 72
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 Sun Feb 16 1997