Creating a file and add some text
The folder where text file to be created and later the text will be added

package ch4_package;
import java.io.*;
public class Test_This {
public static void main(String[] args) throws IOException
{
// TODO Auto-generated method stub
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String file_name ="", str_text="";
Process pp = new Process();
try{
//System.out.println("---While Loop---");
System.out.print("Please Enter a File name: ");
file_name = br.readLine();
System.out.print("Now the text to be added : ");
str_text = br.readLine();
pp.process(file_name, str_text);
}//try
catch(NumberFormatException e)
{ System.out.println("data was blank");}
}
}
class Process {
public String file_name="";

public void process(String str1, String str2)
{
try {
BufferedWriter out = new BufferedWriter(new FileWriter(str1));
out.write(str2);
out.close();
} catch (IOException e) {
}

}

}

verifying with Text pad