Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //// Input From console and Output at Text File. :)
- public class File {
- public static void main(String args[]) throws IOException {
- InputStreamReader cin = null;
- FileWriter fr = new FileWriter("INPUT.txt",true);
- PrintWriter pin = null;
- try {
- cin = new InputStreamReader(System.in);
- pin = new PrintWriter(fr,true);
- System.out.println("Enter characters, 'q' to quit.");
- char c;
- do {
- c = (char) cin.read();
- System.out.print(c);
- pin.printf("%s", c);
- } while(c != 'q');
- }finally {
- if (cin != null) {
- cin.close();
- pin.close();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement