返回列表 發帖
  1. import java.util.Scanner;
  2. public class junior {
  3.     public static void main(String args[])
  4.     {
  5.        Scanner c = new Scanner(System.in);
  6.        String str1,str2 ;
  7.        int a ;
  8.        float b;
  9.        System.out.print("請輸入一字串(帶空白): ");
  10.        str1=c.nextLine();
  11.        System.out.println(str1);
  12.        System.out.print("請輸入一字串(不帶空白): ");
  13.        str2=c.next();
  14.        System.out.println(str2);
  15.       
  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

返回列表