Section numbers ( in bold ) refer to The Java Language Specification, Version 1.0 July 5, 1996; Draft 5.1.

Remember: 4.5.5 Variables have types, Objects have Classes.

Kinds of Types. Types are compile time determinable.

  1. 4.2 Primitive Types
  2. 4.3 Reference Types
    1. Class Type
    2. Interface Type
    3. Array Type
Objects have a Class, and that class might implement an interface. An object implementing an interface can be assigned to a variable of the interface's type.

Arrays extend Object. They have a field length of type int which gives the number of elements in the array. The length can be zero, which is the empty array, distinct from an array variable of value null.

5.1 Kinds of Conversion

  1. 5.1.1 Identity Conversion Boolean Primitive type allows only this Conversion.
  2. Widening Conversion:
    1. 5.1.2 Primitive (run time)
    2. 5.1.4 Reference (compile time)
  3. Narrowing Conversion:
    1. 5.1.3 Primitive (run time)
    2. 5.1.5 Reference (run time)
  4. 5.1.6 String Conversion There is a string conversion to type String from every other type, including the null type.
Map of primitive widening/narrowing. To widen, go up, to narrow, either go down or the 4 sideways avenues between char and short or byte. There are 19 widening and 23 narrowing conversions depicted here.
        double
          | 
        float 
          |
         long
          |
         int
          |
         /  \
        /    \
       /  +->short
    char<-+    |
          +-> byte
Conversion contexts.
  1. Assignment
  2. Method invocation
  3. Casting
  4. String
  5. Numeric promotion
Type of a variable.
  1. 4.5.1 Primitive. Then the run time and compile time type always agree.
  2. 4.5.2 Reference. Then the run time type is a reference to an object which has a class, which might not be the same class as the compile time type of the variable. 4.5.5 Variables have types, Objects have Classes.
4.5.3 Kinds of Variables.
  1. Local
  2. Instance
  3. Class
  4. Method parameters
  5. Constructor parameters
  6. Array components
  7. Exception-handling parameter