Copyright

Difference Between Object & Instance in Java

Instructor: David Gloag
In this lesson, we'll take a look at Java, what an object is in Java, what an instance is in Java, and how these two differ. At the end, you should have a good understanding of these important concepts.

The Closeness of the World

We live in a globally accessible world, a world where a person living on one side of the Earth is but an email, instant message, or phone call away from someone on the other side of the Earth. If we want news about something that happens anywhere in the world, it is as close as a few clicks on a web browser. A lot of us have grown up with this, so it's second nature. But how does this all work? And how much of it do we really understand? We know there are a number of technologies involved. Some, like personal computers and cell phones, are right in front of us. The rest of the technology is behind the scenes, quietly going about its business. One of these is Java.

What is Java?

Java is a computer programming language that exists on billions of devices worldwide and supported by millions of developers. But its beginnings were humbler. Created in 1991 by Sun Microsystems, it was originally called OAK and meant for general purpose programming tasks. As a result, it became part of things like cell phones and tablets. Unfortunately, when that wasn't as successful as anticipated, it was modified in 1999 to take advantage of the Internet. It was eventually purchased by Oracle in 2009, where it continues today.

What is an Object in Java?

An object in Java is the physical manifestation of a class. It occupies memory and has data members that can be assigned values. If you think about it, we see many class-object relationships in the real-world. For example, consider the blueprint for a house. This is the equivalent of a class, a template that describes how a house of this type would be built. An object is every house that is built according to the blueprint. From Java's perspective, a class is represented by the class declarations we see in the code. An object is any variable that can be declared having the specified class type.

What is an Instance in Java?

An instance in Java is much like an object. It is a physical manifestation, it occupies memory, and has data members that can be assigned values. The blueprint example also applies. The blueprint is the equivalent of a class, a template that describes how the house should be built. An instance is a particular house built according to the blueprint. From the Java language perspective, an instance is any variable that can be declared having the specified class type, and assigned specific values for the data members.

To unlock this lesson you must be a Study.com Member.
Create your account

Register for a free trial

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use Study.com

Become a Study.com member and start learning now.
Become a Member  Back
What teachers are saying about Study.com
Free 5-day trial

Earning College Credit

Did you know… We have over 160 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Create an account to start this course today
Try it free for 5 days!
Create An Account
Support