Anonymous user
File input/output: Difference between revisions
→{{header|Scala}}
(→{{header|Scala}}: Exception-handling added) |
|||
Line 1,889:
MyFileTxtTarget.close()
MyFileTxtSource.close()
scala.io.Source.fromFile("output.txt").getLines().foreach {
line => println(line)
}
} catch {
case e: FileNotFoundException => println(e.getLocalizedMessage())
case e: Throwable => {
println("Some other exception type:")
e.printStackTrace()
}
}
}</lang>
|