Read: http://www.learnjavaonline.org/en/Variables_and_Types
byte
(number, 1 byte)short
(number, 2 bytes)int
(number, 4 bytes) <<<integerlong
(number, 8 bytes)float
(float number, 4 bytes)double
(float number, 8 bytes) <<<decimal numberchar
(a character, 2 bytes)boolean
(true or false, 1 byte) <<<logicThink objects as...well, a real object!
Objects contain more stuff than primitives. For example, String is an object. Objects require a constructor to construct itself, like:
Car c = new Car("Honda", 2018);
String is an exception. You don't need the constructor. You just use the quotation mark.
"this is automatically a string"
We'll learn more about this in later chapter.
Do the exercise (print out: H3110 w0r1d 2.0 true )
When you are confident, try the quiz below.
(hey, no cheating!)
Complete this quiz without any outside resource!
This will be graded!!!
Created: Dexin in mid-march 2018
Updated: Dexin, 12/5/18