File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Difference between Instance, Object and reference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Difference between Instance, Object and reference" Watch "Difference between Instance, Object and reference" New topic

Difference between Instance, Object and reference

Atul Sawant
Ranch Hand

Joined: Jul 06, 2006
Posts: 304
Can someone please let us know what is the difference between object, instance and reference?

Mission SCWCD. Mission SCJP Complete: SCJP 1.4 - 91%
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809

Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Naina Si
Ranch Hand

Joined: Nov 05, 2003
Posts: 134
Object is an instance of a Class. You can create many instances of a class (Objects of that particular Class type)

You can refer to objects using references.
Karun Subramanian

Joined: Aug 10, 2006
Posts: 3
Hi !

Object = Instance of a Class.
Instance = Object
Reference = A variable that holds bit patern which points to the Object in the Memory (Heap).


public class Car {
int year;
String make;
public static void main(String[] args) {
Car mycar = new Car(); // Create a Car object.
// Here mycar = Reference variable that points to the Object of type Car
I agree. Here's the link:
subject: Difference between Instance, Object and reference
It's not a secret anymore!