Skip to content

Instantly share code, notes, and snippets.

@FreeFly19
Created November 21, 2016 21:12
Show Gist options
  • Select an option

  • Save FreeFly19/137a71933d2587254d0350d82f1f1223 to your computer and use it in GitHub Desktop.

Select an option

Save FreeFly19/137a71933d2587254d0350d82f1f1223 to your computer and use it in GitHub Desktop.
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class Task2 {
public static void main(String[] args) throws IOException {
File file = new File("D:/test-java.txt");
file.createNewFile();
FileOutputStream outputStream = new FileOutputStream(file);
outputStream.write("Hello, dear student!\nHow are you?".getBytes());
outputStream.close();
TextFileReader textFileReader = new TextFileReader(file);
System.out.println(textFileReader.getContentAsString());
file.delete();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment