[Solved] How to compare objects by property
[ad_1] I assume you have a name variable in your Product class. So what you would want to do is compare the name variable to the String. Something like this: private String name; Product laptop = new Product(1, “Laptop”, “Type”, 1350.25, “black”); Product mouse = new Product(2, “Mouse”, “Type”, 50.50, “black”); String check = new … Read more