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

  3.         public static void main(String[] args) {
  4.                 {
  5.                         for(;;)
  6.                         {
  7.                                 try
  8.                                 {
  9.                                         Scanner s=new Scanner(System.in);
  10.                                         ;
  11.                                         int x,y;
  12.                                         System.out.print("輸入分子");
  13.                                         x=s.nextInt();
  14.                                         System.out.print("輸入分母");
  15.                                         y=s.nextInt();
  16.                                 }catch(Exception e)
  17.                                 {
  18.                                         System.out.println("程式錯誤");
  19.                                         System.out.println("例外類別");
  20.                                 }
  21.                                 System.out.println();
  22.                         }
  23.                 }
  24.         }


  25. }
複製代碼

TOP

返回列表