Basic HTML version of Foils prepared 18 May 97

Foil 16 Java Language -- Variable/Expression Types

From Java Tutorial - Spring 1997 Part II: Java Language and Object-Oriented Concepts Peking Tutorial, Web Certificate -- Spring-Summer 1997. by Nancy J. McCracken,Geoffrey C. Fox


1 Each Java variable or expression has a definite type, given by a declaration such as"int i;". 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!
2 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.
3 One can use casts for conversion such as longint = (long) i; // which can be explicit as here and sometimes implied (see later)
4 Note booleans are either TRUE or FALSE -- they are not 0, 1 ,-1 ...

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 Thu Jan 8 1998