点击(此处)折叠或打开
- def main(args: Array[String]) {
- val file = Source.fromFile("D:\\test.txt")
- for (line <- file.getLines){ println(line)}
- file.close
-
- val webFile = Source.fromURL("http://spark.apache.org/")
- webFile.foreach(print)
- webFile.close
-
- val writer = new PrintWriter(new File("scalaFile.txt" )) //
- for (i <- 1 to 100) writer.println(i)
- writer.close()
-
- print("Please enter your input : " )
- val line = readLine
- println("Thanks, you just typed: " + line)
- }
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28912557/viewspace-1848784/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28912557/viewspace-1848784/