File Operation in scala
File operation is important operation in an application. We might have to provide some configuration information or some input for application in such scenario we have to perform file operation. There are different kind of files formats like txt, csv, conf, and so forth. Most of the programming language provides default support for .conf file format other than that we have to write our code to perform file operation. File operation is comparatively easier in scala.
import scala.io.Source val filename = "sample.txt" for (line <- Source.fromFile(filename).getLines()) { println(line) }