阿里云服务器代金券领取(最高2000元)
https://www.aliyun.com/minisite/goods?userCode=3ls0qk0b

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")
         }
      }
   }

 

posted @ 2020-05-24 22:25  H有何不可?  阅读(808)  评论(0)    收藏  举报
阿里云服务器代金券领取(最高2000元)
https://www.aliyun.com/minisite/goods?userCode=3ls0qk0b