返回列表 發帖
  1. import  java.util.Scanner;
  2. public class ch02 {

  3.         public static void main(String[] args) {
  4.                 Scanner c=new Scanner(System.in);
  5.                 String str1,str2;
  6.                 int a;
  7.                 float b;       
  8.                 System.out.print("請輸入一字串(帶空白): ");
  9.                 str1=c.nextLine();
  10.                 System.out.println(str1);
  11.                 System.out.print("請輸入一字串(不帶空白): ");
  12.                 str2=c.next();
  13.                 System.out.println(str2);
  14.                 System.out.print("請輸入一整數: ");
  15.                 a=c.nextInt();
  16.                 System.out.println(a);
  17.                 System.out.print("請輸入一浮點數: " );
  18.                 b=c.nextFloat();
  19.                 System.out.println(b);
  20.         }

  21. }
複製代碼

TOP

返回列表