FileOutputStream is a class present in java.io package and child class of outputstream class. It Stores data in the form of bytes. It is used to create a text file.

In this program we are using BufferedReader class which is child class of Reader class is used to read data from keyboard.BufferedReader file = new BufferedReader(new InputStreamReader(System.in));Here file is the object of the FileOutputStream class that points to " test txt file, if the file is not present it creates a new file.FileoutputStream file=new FileoutputStream("Hello.txt");ch=(char)br.read()file.write(ch);To close the file we have to close the associated streams.file.close();