Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • I am trying like this , I still don't understand why it doesn't match: String found = null; for (String account: all_accounts) { for (String canceled: cancel_accounts) { System.out.println(canceled); found = canceled; } System.out.println(found); if(account.equals(found) ) { System.out.println(account); } } Commented Nov 21, 2016 at 23:15
  • Try it EXACTLY as the answer above - and watch where you put curly brackets. What you have pasted in the above comment has a serious logic mistake. Commented Nov 22, 2016 at 7:40
  • I think the issue is that all the data is coming one element at a time, as in data sample above, thats why I can not find the match. Commented Nov 22, 2016 at 14:36
  • did you run the code above? If there are 2 same strings in those 2 arrays, code above will work. Commented Nov 22, 2016 at 19:41