Examples
Reading standard input
import scala.io.StdIn
object Demo {
def main(args: Array[String]): Unit = {
val in = StdIn.readLine()
println(s"Hello, $in!")
}
}
Reading a file
import java.nio.file.Files
import java.nio.file.Paths
object Demo {
def main(args: Array[String]): Unit = {
val path = Paths.get("file.txt")
println(Files.readString(path))
}
}