Skip to main content
Lesson 12 - Object References
Lesson MenuPreviousNext
  
Primitive Data Type Variables page 3 of 10

  1. Java has many data types built into it, and you (as a programmer) can define as many more as you need. Other than the primitive data types, all data types are classes. In other words, data is primitive data or object data. The only type of data a programmer can define is an object data type (a class).

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

    public class primitiveDataType
    {
      public static void main(String[] args)
      {
        long value;
    
        primitiveValue = 95124;
        System.out.println(primitiveValue);
      }
    }
  3. 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

    primitiveValue = 95124;

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

  4. 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 for an integer.


Lesson MenuPreviousNext
Contact
 ©ICT 2003, All Rights Reserved.