This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes simple instantiation from Mughal book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "simple instantiation from Mughal book" Watch "simple instantiation from Mughal book" New topic
Author

simple instantiation from Mughal book

Jarrod Legion
Greenhorn

Joined: Dec 24, 2002
Posts: 18
Hi All,
The code below contains two classes, and an inerface. In class Planet, shouldn't the Star object orbiting be instantiated before it can use the method describe()? Without instantiating the Star class it compiles, but gives a NullpointerException, as it should, during execution. Can someone please tell me if I am right?
Mughal keeps a nice Errata page, but this isn't on it, so I am curious as why it isn't.


TIA,
-Jarrod
Yosi Hendarsjah
Ranch Hand

Joined: Oct 02, 2003
Posts: 164
You're right.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: simple instantiation from Mughal book
 
Similar Threads
Another question from Khalid
KAM India Edition Question 6.27
Help needed on Inheritance
why would this code run without an error?
looking at this code, why Planet class is not a Star class?