Object Oriented Programming - Lesson 4: Object Initialization and Usage Acquaint how to initialize and use objects, Data initialization and constructor, Object declaration and initialization, Object usage. | LESSON IV Object Initialization and Usage Trinh Thanh TRUNG (MSc) trungtt@ Objectives • Acquaint how to initialize and use objects Content • Data initialization and constructor • Object declaration and initialization • Object usage I. Data initialization • Needs of initialize data before using • Primitive data type: initialize by assignment operator • Object (reference data type): initialize by using constructor. Constructor • Objects are created through constructors – instance variables of an object are initialized in the scope of constructors. • A class may declare its own constructor or rely on the default constructor provided by the Java environment. – The name of constructor is the name of class – Constructor is written without return type; the default return type of a class constructor is the same .