- 题目:两个字符串连接程序
1 public class _046ConnectString {
2
3 public static void main(String[] args) {
4 connectString();
5 }
6
7 private static void connectString() {
8 Scanner scanner = new Scanner(System.in);
9 System.out.println("请输入一串字符串:");
10 String string1 = scanner.nextLine();
11 System.out.println("请输入一串字符串:");
12 String string2 = scanner.nextLine();
13
14 String string3 = string1 + string2;
15 System.out.println("合并的字符串是 :" + "\n" + string3);
16 }
17
18 }