def testPrintAndWriter()=
  {
    val line = StdIn.readLine()
    val writer = new PrintWriter(new File("test.txt" ))
    writer.write("sea write "+line)
    writer.close()
    println("文件内容为:" )
    Source.fromFile("test.txt" ).foreach{
      print
    }
  }

 

posted on 2020-05-15 16:56  lshan  阅读(211)  评论(0编辑  收藏  举报