fork download
  1. class Dog{
  2. private String name;
  3. private int age;
  4.  
  5. public boolean equals(Object obj) {
  6. if(!(obj instanceof Dog)) return false;
  7. if (this.name.equals(obj.name) && (this.age == obj.age)) {
  8. return true;
  9. }
  10. else {
  11. return false;
  12. }
  13. }
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:7: error: cannot find symbol
    if (this.name.equals(obj.name) && (this.age == obj.age)) {
                            ^
  symbol:   variable name
  location: variable obj of type Object
Main.java:7: error: cannot find symbol
    if (this.name.equals(obj.name) && (this.age == obj.age)) {
                                                      ^
  symbol:   variable age
  location: variable obj of type Object
2 errors
stdout
Standard output is empty