frantisek nejedly

Ranch Hand
+ Follow
since Sep 09, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by frantisek nejedly

I see, thank you.
9 years ago

[ October 10, 2008: Message edited by: frantisek nejedly ]
9 years ago
The parameter is a name of reference variable which refers to the object of type Exception created when the Exception is thrown.

Am I right?
9 years ago
I've read that before posting the question. I'm going there once again. Thank you.
9 years ago
Hi,
it's not clear to me what the parameter is and how to use it.
Could you tell me please?
Thank you.
9 years ago
final version, no 'return 0' needed


[ October 04, 2008: Message edited by: frantisek nejedly ]
[ October 04, 2008: Message edited by: frantisek nejedly ]
9 years ago
Did you mean something like this?


[ October 04, 2008: Message edited by: frantisek nejedly ]
9 years ago
Thanks a lot Tom.
9 years ago
I understand, I haven't learnt exceptions yet, regarding this, could be the code, as it is, considered as an acceptable one, including standalone Print class?
9 years ago

#1 - Instead of returning 0 you could return a negative value, clearly indicating that it is not a valid value. You could also throw an exception.


I see.
a - Can be the option of returnig negative value from NA methods considered as a normal and valid solution in this situation?
b - What if the negative return value is a valid one (of course not for shapes here)?



#2 - The print method should be part of the Shape interface, and thus be implemented by each class implementing the interface.


I see. I will play with it using Tom's suggestions.

Thank you very much.
9 years ago
Hi, please could you evaluate the following training code (the first one on interface)?
To keep the classes clear, I put all the printing stuff to a separate class Print - this was my intention.
The code is a bit larger but easy to read, I hope.

I don't like two things there, please give me advice on them.
1. these "returns 0" - I have no knowledge how to treat the methods which are not applicable for particular shape
2. when I want to create another shape I will have to also add appropriate code block to the print method

If the concept is totally stupid, just tell me.

Thanks a lot.



[ October 03, 2008: Message edited by: frantisek nejedly ]
[ October 03, 2008: Message edited by: frantisek nejedly ]
9 years ago
Yes, I know this. Thank you.
9 years ago
There is an abstract class and I only remove the keyword abstract.
Is the class functionality the same as before except for ability to be instantiated? Or is there anything more?
Thank you.
9 years ago
I've just checked the errata for the book, you're right. Thanks.
9 years ago