返回列表 發帖
  1. import java.lang.System;
  2. import java.util.Scanner;
  3. public class Ch50
  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.         System.out.print("請輸入一字串(不帶空白): ");
  15.         str2=s.next();
  16.         System.out.println(str2);
  17.         System.out.print("請輸入一整數: ");
  18.         a=s.nextInt();
  19.         System.out.println(a);
  20.         System.out.print("請輸入一浮點數: ");
  21.         b=s.nextFloat();
  22.         System.out.println(b);
  23.     }
  24. }
複製代碼

TOP

返回列表