SCJP1.5(81%), SCDJWS(94%), next mission SCEA (but need to wait or that)
cmbhatt
cmbhatt
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
SCJP1.5(81%), SCDJWS(94%), next mission SCEA (but need to wait or that)
Still I am confused what I understood is like when an object is referencing to nowhere it is eligible for garbage collection or if its value is null.If I am wrong please correct me.
cmbhatt
Originally posted by Divya Gehlot:
Hi Bert,
what I understood is like when an object is refrencing to nowhere it is eligible for grabage collection or if its value is null.If I am wrong please correct me.
Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
http://www.lifesbizzare.blogspot.com || OCJP:81%
http://www.lifesbizzare.blogspot.com || OCJP:81%
http://www.lifesbizzare.blogspot.com || OCJP:81%
Vishal Hegde wrote:am i right Mr Bert Gates
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ankit Garg wrote:
Third code is not right in accordance to what you are trying to achieve. The statement says "one object, referring to another object", but in your code, two references are pointing to the same object. Look at the following code.
http://www.lifesbizzare.blogspot.com || OCJP:81%
Vishal Hegde wrote:- can you show an example of one object (sort of), referring to another object?
class Obj1
{
}
class Obj2 extends Obj1
{
}
class Obj3 extends obj2
{
public static void main(String args[])
{
Obj1 o1=new Obj1();
Obj2 o2=new Obj2();
Obj3 03= new Obj3();
o2=o3;
}
}
Am i right??? Mr Bert??
o1's value = 100 so, o1------------------> 100 address in heap that is new Obj1()
o2's value = 200 so, o2------------------> 200 address in heap that is new Obj2()
o3's value = 300 so, o3-------------------->300 address in heap that is new Obj3()
o2=o3
as o3's has 300
o2=300 so o2's new value = 300
o2 ,o3 both-----------------------> 300 address in heap that is new Obj3()
SCJP 6
He was expelled for perverse baking experiments. This tiny ad is a model student:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|