View Single Post
Old 08-19-2016, 10:33 PM   #2
addisoncave
Registered User
 
Join Date: Jun 2016
Posts: 169
Object Oriented Programming is a more efficient approach of programming, that focus on data rather than function.Object is quite similar to a real time entity that have some attributes and behavior, where Class is the blueprint of an object. we create object to work with everything. First we design a prototype of that object object with class.
The simplified syntax of code in Java is:
Quote:
class Rectangle{ //creating class
int length; //variable members (attribute)
int width;

void insert(int l,int w){ //member methods (behavior)
length=l;
width=w;
}

void calculateArea(){System.out.println(length*width);}

public static void main(String args[]){
Rectangle r1=new Rectangle(); //creating object
Rectangle r2=new Rectangle();

r1.insert(11,5);
r2.insert(3,15);

r1.calculateArea();
r2.calculateArea();
}
}
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
addisoncave is offline   Reply With Quote