Close
Close

Java Object Oriented Programming


Welcome to the part of programming for which Java is widely known for: Object Oriented Programming (OOP).

Let’s try to understand the concept of Object Oriented Programming. Think of a book having a serial number and a number specifying the number of pages in the book. Now, suppose you have two types of books - Science book and Computer book. Suppose the serial number of the Science book is SC12 and that of the Computer book is CS34 and the number of pages are 200 and 250 respectively, as shown in the following figure.

OOPs in Java

Here, ‘Book’ is a class having attributes 'Page' and 'Serial number', and 'Science' and 'Computer' are objects of ‘Book’.

So, now you understand that class is something which acts like a base, having some attributes or features(Page and Serial Number in this case). And objects are instances of class following those definitions.

Basically, a class provides a structure and objects of that class follow that structure.

One more example of class and objects is a bank account. Think of 'Account' as a class having attributes 'min_balance' and 'rate_of_interest', and 'Saving' and 'Current' as its objects.

OOP in Java

I hope you have got the feel of classes and objects. We will be programming this in the next chapter.

You Learn More From Failure Than From Success. Don’t Let It Stop You. Failure Builds Character.


Ask Yours
Post Yours
Doubt? Ask question