A good answer might be:

Data TypePrimitive Class
int    X    
String        X
long    X    
double    X    
Applet        X
boolean    X    
Graphics        X

The correct way to do this is to recognize the primitive data types. Everything else must be a class.

A Primitive Variable

Here is a tiny program that uses a primitive data type:


class egLong
{

  public static void main ( String[] args )
  {
    long value;

    value = 18234;

    System.out.println( value );
  }
}

In this program, the variable value is the name for a 64 bit section of memory that is used to hold long integers. The statement

value = 18234;

puts a particular bit pattern in that 64 bit section of memory.

With primitive data types, a variable is a section of memory reserved for a value of a particular style. For example by saying long value, 64 bits of memory are reserved for an integer. By saying int sum, 32 bits of memory are reserved an integer.

Object reference variables do not work this way, however. The next several pages will discuss this.

QUESTION 3:

(Thought Question:) Each primitive data type is made of a fixed number of bits. For example, all variables of type double are 64 bits long. Do you think that all objects of the same type are the same size? Click here for a