Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. public void findNameOnly(String name) {
  2. for (int j = 0; j < this.myContacts.size(); j++) {
  3.  
  4. System.out.println("name = " + name);
  5. System.out.println("getname() = " + this.myContacts.get(j).getName());
  6. System.out.println("value of j = " + j);
  7. System.out.println(this.myContacts.get(j).getName().trim() == name.trim());
  8.  
  9. System.out.println("name length = " + name.length());
  10. System.out.println("getname() length = " + this.myContacts.get(j).getName().length());
  11.  
  12. if (this.myContacts.get(j).getName().trim() == name.trim()) {
  13. System.out.println("Found SOME record...");
  14. } else {
  15. System.out.println("NO MATCH");
  16. }
  17. }
  18. }
  19.  
  20. getname() = Jon
  21.  
  22. getname() length = 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement