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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Array output" Watch "Array output" New topic
Author

Array output

Shamsul Kamal
Greenhorn

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"};

Output:

a
bb
c
dd
e

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="http://faq.javaranch.com/java/UseCodeTags" target="_blank" rel="nofollow">Use Code Tags!!</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Array output
 
Similar Threads
How to solve this problem
inputstream and outputstreams
Reg. Stream basic question
Logic with java code
Stuck on Homework