Which causes the 'incompatible types' error message to be generated.
Joined: Oct 31, 2007
Model Exam Questions Answer 9-3(Pg 200)
double d=v.elementAt(0); If we dont add the <Double> to the Vector keyword, it doesnt compile at all, so that is a must, apart from that the autoboxing converts the instance of the object to float or double, so this would be one of the correct answers. Am I right?
In your next question's answer (9-4), the answer you have given is Double d=(Double)v.elementAt(0); which does'nt work either. I think the correct answer should be
Float f=(Float)v.elementAt(0); and/or float f=(Float)v.elementAt(0); What do you say?
[ November 21, 2007: Message edited by: kanaka krishna ]
[ November 21, 2007: Message edited by: kanaka krishna ] [ November 21, 2007: Message edited by: kanaka krishna ]
Cameron Wallace McKenzie
author and cow tipper
I just answered the same question in an email to you.
I try not to hijack the SCJA forum to talk directly about my books. Just email me through the ranch, or through my personal email, and I'll get back to you much faster. I visit the ranch when I've got the time, but I always check my email regularly.