my dog learned polymorphism
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
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>
I agree. Here's the link:
subject: Array output
It's not a secret anymore!