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


  2. public class Hello {

  3.         public static void main(String[] args) {
  4.                 // TODO 自動產生的方法 Stub

  5.                 Scanner s=new Scanner(System.in);
  6.                 try
  7.                 {
  8.                     int x ,y;
  9.                     System.out.print("請輸入分子:");
  10.                     x=s.nextInt();
  11.                     System.out.print("請輸入分母:");
  12.                     y=s.nextInt();
  13.                     System.out.println("x/y="+(x/y));
  14.                 }catch(Exception tim)
  15.                 {
  16.                         System.out.println("出錯了");
  17.                         System.out.println("在"+tim.toString()+"  錯了");
  18.                 }finally
  19.                 {
  20.                         System.out.println("?!?!");
  21.                 }
  22.         }

  23. }
複製代碼

TOP

返回列表