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


  2. public class Ch01 {

  3.         public static void main(String[] args) {
  4.                 for(;;){
  5.                 try{
  6.                 Scanner s=new Scanner(System.in);
  7.                 int x,y;
  8.                 System.out.print("請輸入x =");
  9.                 x=s.nextInt();
  10.                 System.out.print("請輸入y =");
  11.                 y=s.nextInt();
  12.                 System.out.println("x/y="+x/y);
  13.                 }catch(Exception e)
  14.                 {
  15.                         System.out.println("發生例外錯誤!");
  16.                         System.out.println("例外類別:"+e.toString());
  17.                        
  18.                 }
  19.                 System.out.println();
  20.                 }
  21.         }

  22. }
複製代碼

TOP

返回列表