scala problem

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 =>
    }

If try is different, catch cannot exit the program, why?

Guess you like

Origin blog.csdn.net/qq_38705144/article/details/112944530