This preview shows page 1. Sign up to view the full content.
Unformatted text preview: t; has the course “+
System.out.println(course2.studentName + " has the course “+
} Page 17 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Practical hint
• Class Course will not execute by itself
– It does not have method main
• CourseRegistration uses the class Course.
– CourseRegistration, which has method main,
creates instances of the class Course and
uses them. Page 18 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Class and Instance Attributes
• Instance attributes (and methods) are:
• associated with an instance (object) of the class.
• and accessed through an object of the class.
• each object of the class has its own distinct copy of instance attributes (and methods) • Class attributes (and methods):
• live in the class
• can also be manipulated without creating an instance of the
• are shared by all objects of the class.
• do not belong to objects’ states.
Page 19 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Class Attributes and Objects
• A class attribute is in one fixed location in memory.
• Every object of...
View Full Document
This document was uploaded on 03/03/2014.
- Spring '14