import java.io.*;
public class BasicFileOutput {
public static void main(String[] args) {
try {
String path = "output.txt";
PrintStream out = new PrintStream(new FileOutputStream(path));
out.println("hello world!");
out.println("another line");
out.close();
} catch(FileNotFoundException e) {
System.out.println("Cannot open file");
}
}
}