fork download
  1. import java.util.*;
  2.  
  3. class Cat
  4. {
  5. int age;
  6.  
  7. Cat(int age)
  8. {
  9. this.age = age;
  10. }
  11.  
  12.  
  13. public boolean equals(Cat other)
  14. {
  15. return this.age == other.age;
  16. }
  17. }
  18.  
  19. class Tester
  20. {
  21. public static void main(String args[])
  22. {
  23. Cat rouge = new Cat(1);
  24. Cat mimi = new Cat(3);
  25.  
  26. System.out.print(rouge.equals(mimi));
  27. }
  28. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
false