scala的异常处理try catch

object Test {
   def main(args: Array[String]) {
      try {
         val f = new FileReader("input.txt")
      } catch {
         case ex: FileNotFoundException =>{
            println("Missing file exception")
         }
         case ex: IOException => {
            println("IO Exception")
         }
      }
   }

猜你喜欢

转载自www.cnblogs.com/hhz-97/p/12953097.html