返回列表 發帖
  1. import java.io.Console;
  2. public class Ch05
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         String str1, str2;
  7.         Console c=System.console();

  8.         str1=c.readLine("輸入字串α:");
  9.         str2=c.readLine("輸入字串β:");

  10.         System.out.println("字串α為:"+str1);
  11.         System.out.println("字串β為:"+str2);
  12.     }

  13. }
複製代碼

TOP

  1. import java.io.Console;
  2. public class Ch05
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         int x;
  7.         float y;
  8.         Console c=System.console();
  9.         
  10.         x=Integer.parseInt(c.readLine("輸入整數α:"));
  11.         y=Float.parseFloat(c.readLine("輸入浮點數β:"));

  12.         System.out.println("整數α為:"+x);
  13.         System.out.println("浮點數β為:"+y);
複製代碼

TOP

返回列表