返回列表 發帖
  1. import java.util.Scanner;


  2. public class Ch01 {

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

TOP

返回列表