Introducing new data type
To introduce a new data type, we must define its values, data representation, and operations.
In Java, use a class declaration:
- The class’s instance variables determine the values and data representation.
- The class’s constructors and methods are the operations.
Each object of the class:
- has those instance variables
- is created by one of those constructors
- may be inspected and/or updated by any of those methods.