日期:2014-05-20 浏览次数:20681 次
import java.util.Scanner;
public class StringConcatString {
public static void main(String[] args) {
try {
Scanner scanner = new Scanner(System.in);
String scannerNextLine1 = "";
String scannerNextLine2 = "";
while ((scannerNextLine1 = scanner.nextLine()) != null &&
scannerNextLine1.length() > 0 &&
(scannerNextLine2 = scanner.nextLine()) != null &&
scannerNextLine2.length() > 0) {
char[] charArray1 = scannerNextLine1.toCharArray();
char[] charArray2 = scannerNextLine2.toCharArray();
char[] charArray3 = new char[charArray1.length + charArray2.length];
for (int index = 0; index < charArray1.length; index++) {
charArray3[index] = charArray1[index];
}
for (int index = 0; index < charArray2.length; index++) {
charArray3[index + charArray1.length] = charArray2[index];
}
System.out.println(String.valueOf(charArray3));
}
scanner.close();
} catch (Exception e) {
System.out.println(e);
} finally {
}
}
}