Chapter 1: Introduction to Object Oriented Programming System (OOPS)
Object oriented programming
Object oriented programming is methodology to design a program using objects. It helps to simplify the software development and maintenance.
Class
Class is a collection of objects. It is a logical entity.
Syntax for writing class in Java:
Class class_name {
//write properties and methods here
}
Class Example:
Class add {
int a, b, res;
int addition() {
res = a+ b;
return res;
}
}
Object
Object is a real world entity.
Example: Car, table
Syntax for object creation in Java:
class_name object_name = new class_name();
Object creation example:
add a = new add()
Note: In the coming chapters we will discuss the Object Oriented Programming System (OOPS) concepts using Java programming language as example.