This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Array output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Array output" Watch "Array output" New topic

Array output

Shamsul Kamal

Joined: Dec 05, 2008
Posts: 2
Hi all. I have a problem to print this two array.

String[] a = {"a", "b", "c", "d", "e"};
String[] b = {"b", "d"};



How to get this output with this arrays. I have try to print this with for loop but it's not working. Anybody can help me.
Tom Johnson
Ranch Hand

Joined: May 11, 2005
Posts: 142
One for loop to iterate over the first array, an inner one to iterate over the second array and an if statement to check if the current object from outer is equal to the one in the inner

<a href="" target="_blank" rel="nofollow">Use Code Tags!!</a>
Consider Paul's rocket mass heater.
subject: Array output
jQuery in Action, 3rd edition