The Artima Developer Community
Sponsored Link

Java Buzz Forum
Difference between instance and Object in Java

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Javin Paul

Posts: 1090
Nickname: javinpaul
Registered: Jan, 2012

Javin Paul is Java Programmer working on Finance domain.
Difference between instance and Object in Java Posted: Nov 30, 2014 8:38 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Javin Paul.
Original Post: Difference between instance and Object in Java
Feed Title: Java67
Feed URL: http://www.java67.com/feeds/posts/default?alt=rss
Feed Description: Java and technology tutorials, tips, questions for all programmers.
Latest Java Buzz Posts
Latest Java Buzz Posts by Javin Paul
Latest Posts From Java67

Advertisement
In Java or other object oriented programming language, we often use Object and instance word interchangeably, but sometime it confuse beginners like hell. I have been often asked several times, whether object and instance is same thing or different? Why we sometime use object and sometime instance if they are same thing etc? This gives me idea to write a little bit about it. I will mostly talk on Java conventions perspective. Just like we use word function in C or C++  for a block of code, which can be called by its same, but in Java we refer them as methods. In Java functions are known as methods, similarly objects are known as instances in Java. You have a class, which represent a blueprint of a real world thing e.g. Car, and object represent a real world car e.g. your car, mine car, a red car or a blue car. They are also known as instances of car. One reason of calling instance may be because they are representation of that class at particular instant. In practice, use instance to say about one particular object, and use object to talk about many objects. By the way, it's also worth remembering that Java has class named Object, or java.lang.Object, which is the master class and every other class extend it. This is another reason why using instance is better because it will minimize confusion. So use Object when you want to talk about java.lang.Object and use instance when you want to talk about object of OOPS. Let's take a look more closely in next section.
Read more »

Read: Difference between instance and Object in Java

Topic: Pulse 2.7 Released Previous Topic   Next Topic Topic: JPA Entity Graphs

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use