异常

 

 

 1 object Test1_Exception {
 2   def main(args: Array[String]): Unit = {
 3     try{
 4       val n = 10 / 0
 5     } catch{
 6       case e: ArithmeticException => {
 7         println("算术异常")
 8       }
 9     } finally {
10       println("处理结束")
11     }
12   }
13 }

 

posted @ 2022-05-26 09:53  小王同学学编程  阅读(5)  评论(0编辑  收藏  举报
levels of contents