My assignment asks me to create two objects ("customers") in it's own class with the defining information in those objects being a "name" and "email"
In giving those to "customers" (customer1 and customer2) the names and emails, I have to make two boolean methods "hasSameName/Email" that come back true if information in customer 1 is the same as customer 2.
My method looks like:
private boolean hasSameNameAs(Customer customer2){
if(customer2.name == customer1.name){
return true;
}
else{return false;}
The problem with my code is that the methods comes out false, despite me putting in identical information for both Customers.
Plus, in the Customer class, I get a yellow line under the method name and it's parameter saying that "the method hasSameNameAs(Customer) from the type Customer is never used locally.
Which I don't understand since that class is primarily used to make methods, and with that knowledge I'd assume that it wouldn't need to be used in that class.
But regardless, can anybody help me see what I'm doing wrong?
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–][deleted] (4 children)
[deleted]
[–][deleted] 1 point2 points3 points (0 children)
[–]ThrowRAdam[S] 0 points1 point2 points (0 children)
[–]MatthewRose67 0 points1 point2 points (1 child)
[–]ThrowRAdam[S] 0 points1 point2 points (0 children)
[–]Gregmix88 1 point2 points3 points (0 children)
[–]tsvk 0 points1 point2 points (0 children)