This tutorial demonstrate how to make a file and write text in java. Here a text file is made using the File Class.
This tutorial demonstrate how to make a file and write text in java. Here a text file is made using the File Class.This example demonstrate how to make a file and write string in it. To create a file in java we use the File Class. The instance of the File class is immutable that means the pathname represented by the File object will never change.
import java.io.File;
|
It will create a file name ouput.txt at the current directory. The output.txt file have "This is a example of FileWriter" content written inside.