In Chapter 3, I learned that variables are either reference variables, or primitive variables. When declaring a variable, you need to have a type and name for that variable.
A reference variable value is the bits representing a way to get to an object on the heap. A reference variable is like a remote control. Using the dot operator (.) on a reference variable is like pressing a button on the remote control to access a method or instance variable.
A primitive variable value is the bits representing the value (5, ‘a’, true, 3.1416, etc.). Primitive variables are variables that hold fundamental values, like an integer, boolean, or float. They also come in sizes; these sizes include btye, short, int, and long.
No comments:
Post a Comment