CareBear


SUBMITTED BY: Guest

DATE: Oct. 26, 2014, 5:33 p.m.

FORMAT: Java

SIZE: 785 Bytes

HITS: 740

  1. public class CareBear extends Animal
  2. {
  3. protected String symbol;
  4. public CareBear(String name, String symbol)
  5. {
  6. super(name, true, 2);
  7. String s = symbol;
  8. this.symbol = s;
  9. }
  10. public String getSymbol() {
  11. return symbol;
  12. }
  13. public void setSymbol(String symbol) {
  14. this.symbol = symbol;
  15. }
  16. public boolean equals(Object obj) {
  17. if (this == obj)
  18. return true;
  19. if (!super.equals(obj))
  20. return false;
  21. if (getClass() != obj.getClass())
  22. return false;
  23. CareBear other = (CareBear) obj;
  24. if (symbol == null) {
  25. if (other.symbol != null)
  26. return false;
  27. } else if (!symbol.equals(other.symbol))
  28. return false;
  29. return true;
  30. }
  31. }

comments powered by Disqus