Learn Java Training from the Best Tutors
Search in
What do you understand by Object and Class?
Class is a definition, and object is an implementation/instance of it.
Consider an example of a class Vehicle. The properties of vehicles are:
The number of wheels, Avg. Speed, number of seats, fuel type, etc.
It can be instansiated by providing a values to the properties. like
Car = [number of wheels = 4, Avg. Speed=100km/hr, number of seats=5, fuel type=petrol] etc.
Aeroplane = [number of wheels = 3, Avg. Speed=700km/hr, number of seats=150, fuel type=petrol]
Bicycle = [number of wheels = 2, Avg. Speed=30km/hr, number of seats=1, fuel type=none]
Here Vehicle is a class only with the properties' definition of the properties have no absolute values. Whereas Car, Bicycle, Aeroplane are objects of type Vehicle class.
Object: Object is the instance of the classes. The object is a bundle of software containing related
variables and methods. It contains data and code to operate on those data (functions). Objects are the basic run-time entities of the programming, based on object-orientation. These are the central entities behind the object-oriented programming approach. It may be a person, place, or any data item. It may be any item that the program has to handle.
Classes: A class describes a group of objects with similar properties, common behavior, and common relationships to other objects. It is a collection of objects of similar types. It is a user-defined data type that can be used, just like any other basic data type, to declare variables. The class variables are known as objects or instances of a class, which are the central idea of the object-oriented programming approach.
read lessObject and any thing exist in the world that is either living or non-living. For e.g. a pen, a book etc. An object is an instance of a class. A class is a group of similar objects. for example Animal is a class and cat, dog, cow etc are the objects of the Animal class.
read lessAt the most abstract level, a class is a definition/blueprint that specifies what its instances should contain and how they behave. An object is an instance of the class where every object has its state, while behaviour comes from the class definition.
As we look a little deeper, every object derives its state and behaviour from the class definition hierarchy (a.k.a inheritance). One can visualize it as an onion where each layer/peel corresponds to a class in the hierarchy.
View 16 more Answers
Related Questions
Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com
Ask a QuestionRecommended Articles
Why Should You Learn Java !
Java is the most famous programming language till date. 20 years is a big time for any programming language to survive and gain strength. Java has been proved to be one of the most reliable programming languages for networked computers. source:techcentral.com Java was developed to pertain over the Internet. Over...
Top 5 Reasons to Learn JavaScript
Before we start on the importance of learning JavaScript, let’s start with a short introduction on the topic. JavaScript is the most popular programming language in the world, precisely it is the language - for Computers, the Web, Servers, Smart Phone, Laptops, Mobiles, Tablets and more. And if you are a beginner or planning...
Java: An Object-Oriented Language
Java is the most commonly used popular programming language for the creation of web applications and platform today. Integrated Cloud Applications and Platform Services Oracle says, “Java developers worldwide has over 9 million and runs approximately 3 billion mobile phones”. Right from its first implication as java 1.0...
Some Popular IT Courses in Current Market
In the domain of Information Technology, there is always a lot to learn and implement. However, some technologies have a relatively higher demand than the rest of the others. So here are some popular IT courses for the present and upcoming future: Cloud Computing Cloud Computing is a computing technique which is used...
Looking for Java Training Classes?
Learn from the Best Tutors on UrbanPro
Are you a Tutor or Training Institute?
Join UrbanPro Today to find students near youThe best tutors for Java Training Classes are on UrbanPro
The best Tutors for Java Training Classes are on UrbanPro