Your a and b answer are the same to start off with.Object conversion and casting is allowed only from sub class to super class or super interface. In the first line of b your assigning Base to Object always allowed because every object inherits from Object. You can then assign the reference Object obj to Runnable as long as you cast obj to Base since this is the object obj is referring to and the Base class implements Runnable. The rules for object conversion can be found in any of the cert books, the RHE book of the Mughal book. Mughal goes in to much greater detail.
Joined: Nov 12, 2000
hi! Is there any good site for this topic.I am just referring RHE book.Is it enough for certification exam
Hi! Shabbir My personal opinion is that Khalid has a great explanation on this subject. He has put the rules together in one place. If you read that portion it would help you answer the questions like the one you have posted above with great ease. I sincerely think you should look at that chapter.I can e-mail the rules to you, I do not want to put it in this forum as I am not sure if I will be violating copyright laws. Latha
Originally posted by shabbir zakir: hi! Is there any good site for this topic.I am just referring RHE book.Is it enough for certification exam