javarevisited

javarevisited


What is Object in Java or OOPS - Example Tutorial

Posted: 06 Dec 2012 06:45 AM PST

Object in Java
Object in Java programming language or any other Object oriented programming language like C++ are core of OOPS concept and that's why the name. Class and Object along with Inheritance, Polymorphism, Abstraction and Encapsulation forms basis of any Object oriented programming language e.g. Java. Objects are instances of Class, Class define blue prints and Objects are thing which are created based upon that blueprint. Object are also known as instance in Java, e.g. When we say an instance of String class, we actually mean an Object of String class. Object has state and behaviour in Java. State is represented using instance variable and static variable in Java class and behaviors are implemented using methods in Java. What differentiate two Objects of same class are there state e.g. if we take two instance of String class "A" and "B" there contents are different which is there state. In OOPS programming,  we model real world things into Class and Object e.g. Car class is a blue print of car which may specify that car should have 4 gears, 4 seats an engine etc and every single car is an Object or instance of Car class. If you like to learn more on OOPS concepts and designs, I suggest to read 10 OOPS and SOLID design principles in Java, That will also help to improve your OOPS programming.
Read more »


Post a Comment