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 }