Scala - How to write string to a file in one statement? Code Example

The code for How to write string to a file in one statement?

// Import statement
import java.io.PrintWriter

// Statement to write string to a file 
// in one statement
new PrintWriter("file1.txt") { write("Content of the file"); close }
Code by IncludeHelp, on August 8, 2022 02:50

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.