CS61B Data Structures, UCB(1)
Primitive Types
Each Java type has a different way to interpret the bits:
eg. 72 stored as 01001000
Letter H stored as 01001000
primitive types in Java
- byte
- short
- int
- long
- float
- double
- boolean
- char
Declaring a Variable
When you declare a variable of a certain type in Java:
- Your computer sets aside exactly enough bits to hold a thing of that type.
- Java creates an internal table that maps each variable name to a location.
- Java does NOT write anything into the reserved boxes.
The Golden Rule of Equals
Given variables y and x:
- y = x copies all the bits