返回列表 發帖
  1. import java.util.Scanner;
  2. public class hello01 {

  3.         public static void main(String[] args) {
  4.                 // TODO 自動產生的方法 Stub
  5.                
  6.                
  7.                  Scanner s=new Scanner(System.in);
  8.          String str1, str2;
  9.          System.out.print("請輸入一字串(不帶空白)");
  10.          str1=s.next();
  11.          System.out.println(str1);
  12.          System.out.print("請輸入一字串(帶空白)");
  13.          while((str2=s.nextLine()).equals(""));
  14.          System.out.println(str2);
  15.                   
  16.         }

  17. }
複製代碼

TOP

返回列表