View Single Post
  #3 (permalink)  
Old 11-30-2007, 02:25 PM
codingisfun22 codingisfun22 is offline
Member
 
Join Date: Nov 2007
Posts: 2
codingisfun22 is on a distinguished road
Hi Eranga,

Thank you for the response. I am trying to avoid using a for loop for each set, because I may end up with 36+ sets of characters that I may need to combine together.

I am looking for a solution that will allow this flexibility without using multiple for loops.



Quote:
Originally Posted by Eranga View Post
I'll give a simple code here. Here the output developed by using characters. So have to think about a way to concatenate those characters and make as strings.

Code:
public class StringTest { public static void main(String[] arguments) { String s1 = "abc"; String s2 = "123"; int s1Len = s1.length(); int s2Len = s2.length(); for(int temp1 =0;temp1 < s1Len;temp1++) { for(int temp2 = 0;temp2 < s2Len;temp2++) { char ch1=s1.charAt(temp1); System.out.print(ch1); char ch2=s2.charAt(temp2); System.out.println(ch2); } } } }
Check there how final strings are obtained using print() and println()
Reply With Quote