Given the class Species as defined in Listing 5.19, why does the following program cause an error message? public class SpeciesEqualsDemo { public static void main(String[] args) { Species s1,...



Given the class Species as defined in Listing 5.19, why does the following


program cause an error message?



public class SpeciesEqualsDemo



{



public static void main(String[] args)



{



Species s1, s2; s1.



setSpecies("Klingon ox", 10, 15);



s2.setSpecies("Klingon ox", 10, 15);



if (s1 == s2)



System.out.println("Match with ==.");



else



System.out.println("Do Not match with ==.")



}


}



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here