返回列表 發帖
  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3. public class Haha1
  4. {
  5.         public static void main(String[] args)
  6.         {
  7.            Scanner s= new Scanner(System.in);
  8.            String str1, str2;
  9.            int a;
  10.            float b;
  11.            System.out.print("請輸入一個字串(帶空白): ");
  12.            str1=s.nextLine();
  13.            System.out.println(str1);
  14.           
  15.            System.out.print("請輸入一個字串(不帶空白): ");
  16.            str2=s.next();
  17.            System.out.println(str2);
  18.           
  19.            System.out.print("請輸入整數: ");
  20.            a=s.nextInt();
  21.            System.out.println(a);
  22.           
  23.            System.out.print("請輸入一個浮點數: ");
  24.            b=s.nextFloat();
  25.            System.out.println(b);
  26.         }
  27. }
複製代碼

TOP

返回列表