scala问题

val br = new BufferedReader(new FileReader("E:\\question\\driver.txt"))

    var s: String = null
    var list = ListBuffer[String]()

    try {
    
    
      while ((s = br.readLine()) != null) {
    
    

        if(s == null)
          throw new Exception

        list += s
        s = null
      }
    } catch {
    
    
      case exception: Exception =>
    }

如果不同用try,,catch退出不了程序,为什么?

猜你喜欢

转载自blog.csdn.net/qq_38705144/article/details/112944530
今日推荐