Forums Register Login

dereferencing in java

+Pie Number of slices to send: Send
I have serached on Google but could't find exact concept of derefencing in java,I have few doubt about this concept please clear --

1-is java support derefencing?
2- is Derefencing and aliase is same word?
3- is I am correct if
A a1= new A();
and then later i try to use properties or function of a1

is this called derefencing?
or

if
A a1=new A();
a1= null;
or assigning null to reference is called derefencing?
+Pie Number of slices to send: Send
 

sanjay kumar gupta wrote:I have serached on Google but could't find exact concept of derefencing in java,I have few doubt about this concept please clear --

1-is java support derefencing?



Yes.


When we access a member of the object pointed to by member variable x using "x." we say that we are dereferencing the x variable (or dereferencing the reference that's stored in x).

2- is Derefencing and aliase is same word?



No.

3- is I am correct if
A a1= new A();
and then later i try to use properties or function of a1

is this called derefencing?



Yes.

or

if
A a1=new A();
a1= null;
or assigning null to reference is called derefencing?



No.
+Pie Number of slices to send: Send
Aliasing means using two variables to point to the same reference
+Pie Number of slices to send: Send
 

Campbell Ritchie wrote:Aliasing means using two variables to point to the same reference



<quibble>
I disagree. Variables don't "point to" references. They hold references as their values. In C++, I've heard references referred to as an "alias" for the variable. There's nothing comparable in Java, and I've never heard the term "alias" used to describe that situation.

But perhaps I'm missing out on some (semi-?)standard part of the lexicon?
</quibble>
+Pie Number of slices to send: Send
Thank you all
+Pie Number of slices to send: Send
All right, “point to” was wrong.
The knights of nee want a shrubbery. And a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 704 times.
Similar Threads
Question about object creation
Garbage Collection (Cyclic references) Also known as Object Island
Doubt in garbage collection
Derefencing args[0]
Read file from directory, update contents of the each file
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:28:03.