answersLogoWhite

0


Best Answer

On the lower level of Java, a "reference" can be thought of like a pointer in C. It is essentially an integer which refers to (points to) a location in memory where the object data exists.

// "button" is a reference to a JButton with a "1" on it (the object).

JButton button = new JButton("1");

User Avatar

Wiki User

βˆ™ 15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Difference between reference and object in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between reference and hashcode?

There is no relation between reference and hascode, Java reference is unique pointer which refers an object. so each object will have a unique reference. but 2 diff object can have same hashcode.


Major difference between c and java?

Java is object oriented, C is not...


What is the difference between java and object oriented programming?

java is a programming language/platform that embodies object oriented programming concepts. The question of what is the difference is like asking what is the difference between cars and a Volvo.


Difference between java and C plus plus?

java is an advanced object oriented programming language than c++


What are the different between'a' and ''a in java string methods?

The difference between 'a' and "a" anywhere in Java is that 'a' is a primitive char type, while "a" is a String object.


Define dangling if in terms of java?

A dangling reference is less problematic in Java, because the garbage collector will eventually delete any object that is unreachable. So, even if one object has a reference to a second object, and the second has a reference to the first object, they would eventually be destroyed if they are unreachable from the objects referenced on the stack.A dangling reference is less problematic in Java, because the garbage collector will eventually delete any object that is unreachable. So, even if one object has a reference to a second object, and the second has a reference to the first object, they would eventually be destroyed if they are unreachable from the objects referenced on the stack.A dangling reference is less problematic in Java, because the garbage collector will eventually delete any object that is unreachable. So, even if one object has a reference to a second object, and the second has a reference to the first object, they would eventually be destroyed if they are unreachable from the objects referenced on the stack.A dangling reference is less problematic in Java, because the garbage collector will eventually delete any object that is unreachable. So, even if one object has a reference to a second object, and the second has a reference to the first object, they would eventually be destroyed if they are unreachable from the objects referenced on the stack.


Difference between reference variable and instance variable?

An object is the actual storage space in memory in which some collection of data resides.A reference variable is a variable which refers to the memory location of an object.Look at the pseudocode below:Object obj = new Object();Here obj is the reference variable, and the data to which it refers is the object.


What does the 'this' reference do in Java?

Represents the current object (not usable in static methods).


What are the differences between C and Java reference variables?

Java does not have the concept of Reference Variables. We cannot access the memory location where the data is stored in Java.


How do you delete reference of an object in java?

You can't really delete a reference to an object. You can set the reference to null, which will eventually cause the garbage collector to free up the memory from that reference, but you cannot explicitly delete anything.


What is the use of object cloning in java?

It allows you to keep the original object untouched. In Java, objects are accessed by reference meaning that when you pass it in a function, anything done to it in the function modifies the original object directly.


What is the difference between cc plus plus and java?

C is a procedure oriented language ,Where C++ & java are object oriented language.But java is platform independent.So generally C is called POP.C++ is called OOP.But java is OOP , which is platform independent.If java does not support primitive data type then it is called as pure object oriented language.