java 处理异常练习题

package Hanqi.ec;
import java.util.Scanner;
public class zuoyekehushuru {
    public static void main(String[] args) {
        
        
    System.out.println("请输入一个数字:");
    try{
    Scanner b=new Scanner(System.in);
    int a =b.nextInt();
    }
    catch(Exception ee)
    {
        System.out.println("请您输入正确的数字");
    }
        
}
}

 

转载于:https://www.cnblogs.com/zzyu/p/5536186.html

你可能感兴趣的:(java 处理异常练习题)