Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object-Oriented Programming (OOP). Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package.

Similar presentations


Presentation on theme: "Object-Oriented Programming (OOP). Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package."— Presentation transcript:

1 Object-Oriented Programming (OOP)

2 Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package. This is achieved by creating a project. Each project will have a driver class which uses the different classes. The main method is in the driver class.

3 Creating a Class File The name of the Java source file will correspond to the name of the class. Data elements of the class are declared using the same format as that used to declare variables. Syntax: accessibility type name; The operations are defined as methods.

4 Methods Syntax: modifiers type name (parameters) {variable declarations; statements; } If the type is void a method does not return a value. In the case of any other type the method must return a value of that type.

5 Example


Download ppt "Object-Oriented Programming (OOP). Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package."

Similar presentations


Ads by Google