Features Of OOP
Object
Objects are the entities through which we perceive the world around us. We naturally see our environment as being composed of things which have recognizable identities and behavior. The entities are then represented as objects in the program. In OOP system, an object is the run time entity i.e. a region of storage with associated semantics. In OOP "Object" usually means an instance of a class.
Example of Class and Object
public class Main //Main is name of class
{
int num = 15;
public static void main(String[] args) {
Main myObj1 = new Main();
Main myObj2 = new Main();
// myObj1 and myObj2 are object of main class
System.out.println(myObj1.num);
System.out.println(myObj2.num);
}
}
Comments
Post a Comment