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 Looking for a strategy for solving upcasting/downcasting questions 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 "Looking for a strategy for solving upcasting/downcasting questions" Watch "Looking for a strategy for solving upcasting/downcasting questions" New topic
Author

Looking for a strategy for solving upcasting/downcasting questions

O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

Does anyone have any workable strategy for solving casting questions? I understand when upcasting and downcasting is allowed but when the questions tend to have multiple objects involved i tend to get confused pretty quickly. For example, what is the best approach to a question like this:



Is there any approach to use to solve a question like above? For example can the references be drawn somehow so that i can get a visual representation and can that help?

Thanks
Abdullah Mamun
Ranch Hand

Joined: Mar 19, 2007
Posts: 99

I usually would like to execute each line and put the updated result beside the same line.
Below is an example in comment.
Not sure if it will help you.



MooN
 
wood burning stoves
 
subject: Looking for a strategy for solving upcasting/downcasting questions
 
Similar Threads
ArrayStoreException
Doubt
Assignment
downcasting...
Not happy with the explanation given..