This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import java.util.Scanner;
public class ExcTest {
public static void main(String[] args) {
// 请在Begin-End间编写代码
/********** Begin **********/
// 第一步:接收给定的整数
Scanner input=new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
int x;
// 第二步:求给定两个数的商,并捕获除数为0的异常
try{
x = a / b;
}
catch(Exception e){
{
System.out.println("除数不能为0");
if(b != 0){
System.out.println(a / b);
/********** End **********/