首页 > 其他分享 >10.17

10.17

时间:2024-01-14 22:55:44浏览次数:19  
标签:ArrayIndexOutOfBoundsException ArithmeticException System try catch 10.17 out

异常捕捉

 

public class CatchWho {
public static void main(String[] args) {
try {
try {
throw new ArrayIndexOutOfBoundsException();
}
catch(ArrayIndexOutOfBoundsException e) {
System.out.println( "ArrayIndexOutOfBoundsException" + "/�ڲ�try-catch");
}

throw new ArithmeticException();
}
catch(ArithmeticException e) {
System.out.println("����ArithmeticException");
}
catch(ArrayIndexOutOfBoundsException e) {
System.out.println( "ArrayIndexOutOfBoundsException" + "/���try-catch");
}
}
}

 

public class CatchWho2 {
public static void main(String[] args) {
try {
try {
throw new ArrayIndexOutOfBoundsException();
}
catch(ArithmeticException e) {
System.out.println( "ArrayIndexOutOfBoundsException" + "/�ڲ�try-catch");
}
throw new ArithmeticException();
}
catch(ArithmeticException e) {
System.out.println("����ArithmeticException");
}
catch(ArrayIndexOutOfBoundsException e) {
System.out.println( "ArrayIndexOutOfBoundsException" + "/���try-catch");
}
}
}

标签:ArrayIndexOutOfBoundsException,ArithmeticException,System,try,catch,10.17,out
From: https://www.cnblogs.com/guozi6/p/17964372

相关文章

  • 10.17
    一个程序如果碰到了异常不处理,程序就会立即停止,异常处理就是在异常发生的情况下启动类似于备用方案使程序继续运行Java中的异常捕获结构由try,catch,finally三部分构成,其中,try和catch是必须同时存在的。try中的代码就是可能存在异常的代码,catch中的代码就是try中有异常时的执行方......
  • 10.17
    请看以下代码,你发现了有什么特殊之处吗? 下面两个函数名字都叫square,但是他们的参数类型不同,所以程序不会报错,这是函数的重载,static关键字修饰的函数一个程序里只能有一个,但是这是函数的重载,所以两个虽然都用static修饰但是都能叫相同的名字......
  • 大二快乐日记10.17
    1.配置多个<servlet-mapping>元素Servlet2.5规范之前,<servlet-mapping>元素只允许包含一个<url-pattern>子元素,若要实现Servet的多重映射,只能通过配置多个<servlet-mapping>元素实现。以serveltDemo为例,在web.xml中配置两个<servlet-mapping>元素,代码如下所示......
  • 10.17
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><title>Vue-指令-案例</title><......
  • 2023.10.17
    第13节:估算这一节强调了估算在软件开发中的重要性,并提供了一些建议来提高估算的准确性。1.通过学习估算并发展直觉,你可以展现出一种魔法般的能力,来确定任务的可行性。2.让估算更准确的单位值和描述方法是至关重要的,比如将时间估算从粗略的“大约6个月”改进为更精确的“130个......
  • 10.17 Java异常处理1
     eg:importjavax.swing.*;classAboutException{publicstaticvoidmain(String[]a){inti=1,j=0,k;k=i/j;try{k=i/j;//Causesdivision-by-zeroexception//thrownewException("Hello.Exception!&quo......
  • 10.17日
    今日无事,简单度过。 ......
  • dolphinscheduler报错:Connect to 192.168.xx.xx:8088 [192.168.xx.xx/110.173.196.1]
    报错信息:在dophin中抽取mysql的数据到hive中报错[ERROR]2023-10-2015:33:10.461org.apache.dolphinscheduler.common.utils.HttpUtils:[73]-Connectto192.168.xx.xx:8088[192.168.xx.xx/110.173.196.1]failed:connecttimedoutorg.apache.http.conn.ConnectTimeout......
  • 10.17
    1.我发现一个很好用的ai插件就是idea中的codegeex---一款国产的超级列害的自动补全代码,还能写注释联想代码,甚至还能自动转化想要的代码语言,反正就是大大提高效率减少错误学习ai防止被ai取代,同时还能减少工作量很不错emmm,但还是会自己学的......
  • 2023.10.17 测试总结
    预计得分:145实际得分:148T1考场上没有想出来,打了一个高精度暴力。问题大概在:1.对哈希算法不熟悉。2.数学上对对数的计算不熟悉。耗时:1hT2暴力。没有挂分,正解属于是难以想到的。耗时:1hT3极为接近正解,但是挂分过多。问题有:1.没有检查出来数组开小了。2.......