CS202 Java-52
Types in Java
lJust like C++, we use the keyword class to mean that we are creating a new type
•class Mytype {…}   creates a new data type
lAnd, creating objects of this type is done using new:
•Mytype object = new Mytype();
lLike C++, our classes have data members (fields) and member functions (methods)
lJust like objects outside of a class, data members can be of a primitive type or can be references to another user defined class type (requiring the use of new to actually create an instance of them)
lUnlike C++, primitive types can be initialized directly at the point of definition in the class and references can be initialized to connect to objects in the class as well
l
l