import java.util.Scanner;
public class HelloJava
{ public static void main(String args[])
{ Scanner sc=new Scanner(System.in);
System.out.println("first:");
double a=sc.nextDouble();
System.out.println("secend:");
double b=sc.nextDouble();
try
{ double i; i = a / b;
if (b == 0)
{ throw new Exception ("not0"); }
System.out.println ("print:" + i);
}
catch (Exception e)
{ e.printStackTrace (); }
}
}
if (b == 0)
{ throw new Exception ("not0"); }
这里是除零判断。