| Author |
need help wtih this code!
|
bob michelle
Greenhorn
Joined: Dec 15, 2011
Posts: 2
|
|
been working on this all day..so tired i cant focus on it anymore maybe somebody can help
|
 |
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
|
|
|
And your question is ?
|
Joanne
|
 |
Nico Van Brandt
Ranch Hand
Joined: Mar 31, 2011
Posts: 66
|
|
Your code works (you knew that already) but it is rubbish.
Some notes:
System.out.println("Error:..."). Apart from the fact System.err.println() exists, you should throw ExceptionsDon't repeat yourself: call the setters that do the checks. In this example it is safe to do so. (but you should be careful calling them from the constructor)Group constructors and getters/setters for a better overviewwriteOutput should not be in this class. Instead override the toString() method. Then when we call System.out.println(myPet), the return value of the toString() method gets printed.
There is more to say but just compare the solutions..
|
Oracle Java SE6 Certified Programmer
Oracle Java EE5 Certified Web Component Developer
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9939
|
|
Nico,
Please don't post a complete solution to the problem. We encourage people to figure it out for themselves. Hint, suggest, or lead them to the answer, but please don't provide a fully implemented program.
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: need help wtih this code!
|
|
|