返回列表 發帖
  1. import java.util.Scanner;
  2. public class Ch01
  3. {
  4.     public static void main(String args[])
  5.     {
  6.          Scanner s=new Scanner(System.in);
  7.          String str1, str2;
  8.          System.out.print("請輸入一字串(不帶空白): ");
  9.          str1=s.next();
  10.          System.out.println(str1);
  11.          System.out.print("請輸入一字串(帶空白): ");
  12.          while((str2=s.nextLine()).equals(""));
  13.          System.out.println(str2);
  14.     }
  15. }
複製代碼
Allen

TOP

返回列表