here i find other way ..
when comile clicked .the gettext() will send to .txt file ..
this code have errors .. i want user to enter data and save in text file ..
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package files;
import java.io.*;
import java.util.Scanner;
class Files
{
public static void main(String[] args) throws IOException
{
BufferedReader stdin =
new BufferedReader(new InputStreamReader(System.in));
String s = "junk.txt";
File f = new File(s);
if (f.exists())
{
System.out.print("Overwrite " + s + " (y/n)? ");
}
if(!stdin.readLine().toLowerCase().equals("y"))
return;
}
PrintWriter outFile =new PrintWriter(new BufferedWriter(new FileWriter(s)));
System.out.println("Enter some text on the keyboard...");
System.out.println("(^z to terminate)");
String s2;
while ((s2 = stdin.readLine()) != null)
outFile.println(s2);
outFile.close();
}