返回列表 發帖
  1. import java.util.Arrays;
  2. import java.util.Scanner;

  3. public class Ch01 {

  4.         public static void main(String[] args) {
  5.                 Scanner c=new Scanner(System.in);
  6.                 String str1,str2;
  7.                 int a;
  8.                 float b;
  9.                
  10.                 System.out.print("請輸入字串一:");
  11.                 str1=c.nextLine();
  12.                 System.out.println(str1);
  13.                 System.out.print("請輸入字串二:");
  14.                 str2=c.next();
  15.                 System.out.println(str2);
  16.                 System.out.print("請輸入一個整數:");
  17.                 a=c.nextInt();
  18.                 System.out.println(a);
  19.                 System.out.print("請輸入一個小數:");
  20.                 b=c.nextFloat();
  21.                 System.out.println(b);
  22.         }

  23. }
複製代碼

TOP

返回列表