Does the equals method work with objects? If so, how?
I have a program that is zoo and in the zoo there are branched subgroups of animals that are reptiles. When I do an equals method the main program compiles and it runs. I'm confused how does java know to use the equals method if I'm comparing objects and not specifically int or String? public class Zoo { public static void main(String[]args) { Animal a=new Animal("Bob"); Reptile komodo= new Reptile("Snakey"); komodo.bask(); a.size=3; komodo.size=5; System.out.println(a); System.out.println(komodo); Turtle t= new Turtle("Slowy"); t.hide(); t.size=6; t.numlegs=4; System.out.println(t); System