- import java.util.Scanner;
- public class ch44
- {
- public static void main(String args[])
- {
- Scanner s=new Scanner(System.in);
- String str1,str2;
- System.out.print("請輸入一字串(不帶空白): ");
- str1=s.next();
- System.out.println(str1);
- System.out.print("請輸入一字串(帶空白): ");
- str2=s.nextLine();
- while ((str2=s.nextLine()).equals(""));
- System.out.println(str2);
- }
- }
複製代碼 |