• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Chapter 3 - SELF TEST - Page 269

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following code:


the following output:


The answer in the book doesn't mention object c3, only c1 and the wrapper Short are eligible for collection.
 
Ranch Hand
Posts: 44
Eclipse IDE Firefox Browser Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Fadi,
Please try and use the code tags to make it easier for your fellow ranchers to read your code and help you out. You can see below how nice it looks with the code tags
To answer your question, understand that c3 is not an object. It is a variable reference that could point to a CardBoard object. Here, c3 is pointing to the result of c1.go(c2) which turned out to be null. So c3 is not pointing at any object to begin with.



 
fadi aboona
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Asad Zubair wrote:Hi Fadi,
Please try and use the code tags to make it easier for your fellow ranchers to read your code and help you out. You can see below how nice it looks with the code tags
To answer your question, understand that c3 is not an object. It is a variable reference that could point to a CardBoard object. Here, c3 is pointing to the result of c1.go(c2) which turned out to be null. So c3 is not pointing at any object to begin with.





Thanks Asad, you're truly Asad
i will envelope my code with the code tags going forward.
I missed that c3 is not an object yet, it's only a reference. There are so many details that i tend to forget!! you know i'm not young anymore and it's hard to remember :-(

Regards,
 
reply
    Bookmark Topic Watch Topic
  • New Topic