- import java.util.Scanner;
- public class junior {
- 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);
- }
- }
複製代碼 |