The Java Programming Level

IS = The Java Language
DS = Primitives (Numbers + Text + Booleans) + Composites (Arrays + Objects)
PU = The Java VM
MU = Variables
UI = IDE

The Java Data Set

Java has two types of inexact numbers:

float (32 bit) <: double (64 bit)

(Read the relationship S <: T as members of type S can be substituted for members of type T.)

Java has four types of exact numbers:

byte (8 bit) <: short (16 bit) <: int) (32 bit <: long (64 bit)

Exact numbers can substitute for inexact numbers:

long <: float

Java has two types of text:

char (16 bit) <: String (n bit)

In addition true and false belong to the boolean type.

In addition, programmers can create composite values called objects.

See http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html

Memory

Data is stored in named variables which must be explicitly declared and initialized:

double temperature = 98.6;
int score = 98;
char response = 'y';
string name = "Bob Dobbs";
boolean over18 = true, registered = false;

Instruction Set

Java provides many operators for combining data.

See http://java.sun.com/docs/books/tutorial/java/nutsandbolts/operators.html

The Assignment Operator

For example the assignment operator can be used to change the value stored in a variable:

response = 'n'; // changed his mind
temperature = 37.0; // celsius
score = 100; // instructor mistake
name = "Robert Dobbs"; // oops
registered = true; // he registered today!

Arithmetic and Logic

Java provides the usual assortment of arithmetic operators:

0.3 * (midterm1 + midterm2)/2 + 0.7 * final – absences;

Java provides the usual Boolean operators:

over18 && (registered || !citizen)

Java also provides comparison operators:

age > 18 && 70 <= score && response != 'n' && grade == 'A'