Question: 16. A developer is trying to create a method to compare two potions in a video game to see if they're identical. The Potion class

16. A developer is trying to create a method to compare two potions in a video game to see if they're identical. The Potion class has the following properties... public class Potion \{ String potionName; //String representing name. int potionType; //integer corresponding to type. int level; //integer representing "level" of potion. \} They use the following code to compare two different Potion objects, as a test. Potion p1; //A potion of arbitrary attributes. Potion p2; //Another potion with identical attributes. I/...initialization code... Boolean match =p1=p2; Both Potion objects have identical attributes, but the value "match" is false. How could this be, and what needs to be done to ensure the check is correct? coveraveto method 17. Implement a proper way to compare the potionLevels of two potion objects using the comparable interface: dass potings implements Comprable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
