import java.io.FileReader import java.io.FileNotFoundException import java.io.IOException try{ val f = new FileReader("./test.txt") } catch { case ex: FileNotFoundException => println("File not found") case ex: IOException => println("IOException") } finally { f.close() }
【不完善,待补充】
原文:https://www.cnblogs.com/wooluwalker/p/12301091.html