• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Few queries on Chapter 3 of SCJP 5

 
deepu verma
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following are my queries with reference to Chapter 3 of SCJP 5

1. In the self test of Chapter 3 Question no 2
Should the answer not be 4 objects, since the line Cardboard c3 = c1.go(c2) would also set the c3 object to null.

2. Should the function rt.freeMemory() be rt.getFreeMemory()

Thanks
Deepak

On Page 234 of the book there is a typo System.out.println("y=" + i); should be System.out.println("y=" + y);
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
 
Jacky Zhang
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by deepu verma:

1. In the self test of Chapter 3 Question no 2
Should the answer not be 4 objects, since the line Cardboard c3 = c1.go(c2) would also set the c3 object to null.


no, because c3 is just a reference variable in the stack, no object has ever been created for it to point to in the heap, hence nothing to be GCed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic