返回列表 發帖
  1. import java.lang.*;       //類別庫,常用,自動載入,可忽略
  2. import java.io.Console;  // 抓使用者key 鍵盤時會用到
  3. public class ch04  //類別
  4. {
  5.   public static void main (String arg[]) //方法
  6.   {
  7.     Console cs=System.console();  //宣告cs
  8.     String str1,str2;
  9.     System.out.print ("請輸入第一個字串 :");
  10.     str1=cs.readLine();
  11.     System.out.print ("請輸入第二個字串 :");
  12.     str2=cs.readLine();
  13.     System.out.println("您剛輸入的第一個字串為: "+str1);
  14.     System.out.println("您剛輸入的第二個字串為: "+str2);
  15.   }
  16. }
複製代碼

TOP

返回列表