try{}cath{}不能被if else语句替换的例子

来源:互联网 发布:java培训4个月靠谱吗 编辑:程序博客网 时间:2024/05/22 01:33
import java.util.*;public class TestException {public static void main(String[] args){Scanner sc = new Scanner(System.in);int i=0;try{i = sc.nextInt();}catch(Exception e){System.out.printf("你要输入的类型不对啊");}//System.out.printf("%d \n",i);}}

0 0