program to create a simple txt file.

alpe gulay -2 Tallied Votes 258 Views Share

..'this is a simple program in w/c enables to create a txt file.
it ask input from user first then put that in the txt file.
:-)

import javax.swing.*;
import java.io.*;
public class file
{
	public static void main(String []args)throws IOException
	{
		FileWriter ryt=new FileWriter("c:\\alpe.txt");
		BufferedWriter out=new BufferedWriter(ryt);
		String name=JOptionPane.showInputDialog("Enter your name pls.");
		out.write("Hello, "+name+"!");
		out.write("\r\nThis the simple txt file that you created!");
		out.close();
	}
}