That was one of coding exercises in OCP Java SE 6 Programmer Practice Exams of Bates and Sierra. This exercise is part of chapter 4 Coding exercises (prototype/research/study projects) Section 5: OO Conceptss 5.f
Thanks Stephan van Hulst, I'll take a look at that method.
Joey Sanchez wrote:Yes, that's exactly what the book says. page 150. I read it twice.
It has to be an easier explanation, but we don't know yet :s
How about this? In all the years, and all the students who has gone through K&B, this is the first time, at least on the ranch, that this was every mentioned. This is the first time that anyone mentioned that K&B required that students know how a class can enforce it's subclass to have a constructor with a certain signature.
Don't know what to tell you -- but if there is a way to do it without reflection, I don't see it. Sorry.
I suspect you're right, or it's something similar. I've had a look at the section we're talking about now. It is as has been quoted in this thread, but looking at the other questions around it there's no way anything complicated was intended.
Joey Sanchez wrote:Thank Henry Wong, that could be a way!
As many have already stated, I highly doubt it. It is highly unlikely that any beginners book would expect you to know (or even teach) the reflection libraries.
In rereading my previous post, I understand why you were confused..... I gave the solution because the solution *is* using the reflection libraries -- and since K&B can't be talking about the reflection libraries, I was not taking a learning exercise from you.
However, I guess it could have been read as an alternate solution to using the reflection libraries. Sorry, for the confusion.