Suppose:
String s1="13579";
String s2="2468";
then output would be 123456789
Here my code :
public class JoinString {
public static void main(String[] args) {
String s1 = "13579";
String s2 = "2468";
for (int i = 0; i < s1.length(); i++) {
for (int j = i; j < s2.length(); j++) {
System.out.print(s1.charAt(i) + "" + s2.charAt(j));
break;
}
}
}
}