Constructor Package Encapsulation Abstraction Inheritance Polymorphism Interface

J.E.D.I. to have the ability to enroll and to attend school.

1.2.3 Object

An object is an entity that has a state, behavior and identity with a well-defined role in problem space. It is an actual instance of a class. Thus, it is also known as an instance. It is created everytime you instantiate a class using the new keyword. In a student registration system, an example of an object would be a student entity, say Anna. Anna is an object of the class student. Thus, the qualities and abilities defined in the student template are all applicable to Anna. For simplicity, you can think of a class as a more general term compared to an object.

1.2.4 Attribute

An attribute refers to the data element of an object. It stores information about the object. It is also known as a data member, an instance variable, a property or a data field. Going back to the student registration system example, some attributes of a student entity include name, student number and school level.

1.2.5 Method

A method describes the behavior of an object. It is also called a function or a procedure. For example, possible methods available for a student entity are enroll and attend school.

1.2.6 Constructor

A constructor is a special type of method used for creating and initializing a new object. Remember that constructors are not members i.e., attributes, methods or inner classes of an object.

1.2.7 Package

A package refers to a grouping of classes andor subpackages. Its structure is analogous to that of a directory.

1.2.8 Encapsulation

Encapsulation refers to the principle of hiding design or implementation information that are not relevant to the current object.

1.2.9 Abstraction

While encapsulation is hiding the details away, abstraction refers to ignoring aspects of a subject that are not relevant to the current purpose in order to concentrate more fully on those that are. Introduction to Programming II Page 10 J.E.D.I.

1.2.10 Inheritance

Inheritance is a relationship between classes wherein one class is the superclass or the parent class of another. It refers to the properties and behaviors received from an ancestor. It is also know as a is-a relationship. Consider the following hierarchy. Figure 1.1: Example of Inheritance SuperHero is the superclass of FlyingSuperHero and UnderwaterSuperHero classes. Note that FlyingSuperHero is-a SuperHero. UnderwaterSuperHero is-a SuperHero as well.

1.2.11 Polymorphism

Polymorphism is the ability of an object to assume may different forms. Literally, poly means many while morph means form. Referring to the previous example for inheritance, we see that a SuperHero object can also be a FlyingSuperHero object or an UnderwaterSuperHero object.

1.2.12 Interface

An interface is a contract in the form of a collection of method and constant declarations. When a class implements an interface, it promises to implement all of the methods declared in that interface. Introduction to Programming II Page 11 SuperHero FlyingSuperHero UnderwaterSuperHero J.E.D.I.

1.3 Java Program Structure