Using files command line arguments(inputs) Stored into a File
package com.nt.files;
import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
public class DoQuick
{
private static FileOutputStream fout;
public static void main(String[] args) throws IOException
{
String sr;
fout = new FileOutputStream("F://workspaces//testworkspace//Tasks//src//com//nt//files//learn.txt",true);
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
sr=br.readLine();
while(!sr.equalsIgnoreCase("Quit"))
{
byte[] b=sr.getBytes();
fout.write(b);
fout.write((char)'\n');
sr=br.readLine();
}
}
}
0 comments:
Post a Comment