vitalii_hrushyn
8/4/2016 - 11:08 AM

my redactor

my redactor

package com.gmail.vhrushyn;

import java.io.*;
import java.util.Scanner;

public class main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		System.out.println("type some text, type 'enter' when finish");
		String text = sc.nextLine();
		File file = new File ("your_text.txt");
		try {
			file.createNewFile();
		} catch (IOException e) {
			System.out.println(e);
		}
		try (PrintWriter pw = new PrintWriter(file)) {
			pw.println(text);
		} catch (IOException e){
			System.out.println(e);			
		}
		sc.close();
		System.out.println("Your text saved to file 'your_text.txt'");
	}
}