>>>> look at the code below n plz help be solve the trick ...
>>> [...]
[quoted text clipped - 20 lines]
> The solution I suspect you are thinking of would break rule 3: "3. the
> programe must execute the output statment in the marker method."
Mike Schilling wrote:
>>>>> look at the code below n plz help be solve the trick ...
>>>> [...]
[quoted text clipped - 29 lines]
> I think llyalex's solution is clever and arguably withn the rules. The one
> I thought of is the same as Patricia's.
As I understand the reply, the 'technique suggested by Gordon' was to
use a static initializer as described in the JLS section 8.7, that is
what I suggested.
3. the programe must execute the output statment in the marker method.
nowhere does it say 'the program must execute the marker method'...
However I think the person marking the homework (?) would probably agree
that this was a refactoring too far and mark me down. I believe however
that is is generally better to remove code if possible rather than
adding more. It usually makes things simpler to understand and reduces
the possibility of unexpected behaviour. I suppose I'm trying to defend
my position now.
Actually, IMHO initialisation should occur when the class is loaded, it
doesn't really make sense to me to put initialisation code in a method
that is visible to sub classes. It will be executed when it makes sense,
on loading, not when the sub class decides it's time.
Anyway, all this is just my opinion of course.
Lew - 06 Nov 2007 14:30 GMT
> 3. the programe must execute the output statment in the marker method.
>
> nowhere does it say 'the program must execute the marker method'...
That is ambiguous. The phrase "in the marker method" could apply to
"statement" or "execute" in that sentence; it's not clear which.

Signature
Lew
Patricia Shanahan - 06 Nov 2007 14:37 GMT
>> 3. the programe must execute the output statment in the marker method.
>>
>> nowhere does it say 'the program must execute the marker method'...
>
> That is ambiguous. The phrase "in the marker method" could apply to
> "statement" or "execute" in that sentence; it's not clear which.
Solution A inarguably meets all the requirements. Solution B may meet
all the requirements, depending on exactly how they are interpreted.
I would go with A unless B has sufficient advantage to justify going
back to whoever set the requirements for clarification. Why be clever
when you can be right?
Patricia
Mike Schilling - 06 Nov 2007 17:27 GMT
>>> 3. the programe must execute the output statment in the marker method.
>>>
[quoted text clipped - 9 lines]
> back to whoever set the requirements for clarification. Why be clever
> when you can be right?
Because it's fun?
"Don't try to be too clever" is a good general rule or programming, but this
is a puzzle with deliberately artifical rules.
Mr.Disguise - 12 Nov 2007 19:21 GMT
hi there,
thanks for giving me so many titles. now can i say something as am the
guy that actually posted the question.
the rules r fixed,
nothing to write in methods,
no addition of any new class,
programe must execute the output statement.
i have the solution,
all the thanks goes to u guys. u were very helpful.
well i am a newbie to java ofcourse. but in real am a c# programmer. i
havnt evn thought about any java programe in the past 8 years.
before i leave i will mention that the guy at the top really spent
some good efforts on that "n33d s0lv" msg. n it did gifted me a
smile.
thanks buddy. programmers r normally boring ppl, but i think u do hav
a sense of humor. but plz now dont reply to this msg wid that morse
code again, coz its really hard to decript.
anyways thanks for the help to all u guys.
bye.