- import java.util.Arrays;
- import java.util.Scanner;
- public class Ch01 {
- public static void main(String[] args) {
- Scanner c=new Scanner(System.in);
- String str1,str2;
- int a;
- float b;
-
- System.out.print("請輸入字串一:");
- str1=c.nextLine();
- System.out.println(str1);
- System.out.print("請輸入字串二:");
- str2=c.next();
- System.out.println(str2);
- System.out.print("請輸入一個整數:");
- a=c.nextInt();
- System.out.println(a);
- System.out.print("請輸入一個小數:");
- b=c.nextFloat();
- System.out.println(b);
- }
- }
複製代碼 |