PrintWriter output

Report a typo

Examine what the following piece of code will print to file.txt?

File file = new File("file.txt"); // some file

try (PrintWriter printWriter = new PrintWriter(file)) {
    printWriter.printf("%s dolor sit %s", "Lorem", "ipsum", "amet");
}
Enter a short text
___

Create a free account to access the full topic