package exception; public class lianxiti1 { public static void main(String[] args) { for(int i=0;i<4;i++){ int k; switch(i){ case 0: int zero=0; try{ k=911/zero; } catch(Exception ee) { System.out.println("请您输入正确的数字"); } break; case 1: int b[]=null; try { k = b[0]; } catch(Exception ee) { System.out.println("请您输入正确的数字"); } break; case 2: int c[]=new int[2]; try{ k=c[9]; } catch(Exception ee) { System.out.println("请您输入正确的数字"); } break; case 3: char ch="abc".charAt(99); break; } } } }
时间: 2024-10-09 23:42:55