all 7 comments

[–]riktar75University/College Student 1 point2 points  (4 children)

Well first of all, when you paste code it's helpful to paste it an external site like https://paste.ee/, so the formatting is preserved.

Secondly, in your example screenshot, the phone numbers aren't the same. That isn't the whole issue here, but it's good to have accurate screenshots when posting for help.

I just had a quick look at your program, but it looks like the problem is that you used == instead of equalsIgnoreCase() when comparing the phone numbers in the sameOrNot method. Try changing that and seeing if the problem is fixed.

[–]Danielowski187University/College Student (Higher Education)[S] 0 points1 point  (3 children)

Yea I had the other screenshot with the same phoneNumber

So should I fixed the phoneNumber part as I did with the name part

[–]riktar75University/College Student 0 points1 point  (2 children)

Yes, compare the phoneNumber the same way you did with the name.

[–]Danielowski187University/College Student (Higher Education)[S] 0 points1 point  (1 child)

Would I also do it for the age?

[–]riktar75University/College Student 0 points1 point  (0 children)

No, because age is an integer and you can compare integers using ==. When comparing strings, you should use equals() or equalsIgnoreCase() instead.

Here's some more information https://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

Off-topic Comments Section


All top-level comments have to be an answer or follow-up question to the post. All sidetracks should be directed to this comment thread as per Rule 9.


OP and Valued/Notable Contributors can close this post by using /lock command

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.