- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrinterDemo.java
More file actions
Latest commit
16 lines (15 loc) · 455 Bytes
/
Copy pathPrinterDemo.java
File metadata and controls
16 lines (15 loc) · 455 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// demonstrate writing to console using a character writer
importjava.io.*;
classPrinterDemo {
publicstaticvoidmain(String[] args)
throwsIOException {
// create some variables
inti = 10;
doubled = 1.65;
// create writer (flushOnNewline = true)
PrintWriteraWriter = newPrintWriter(System.out, true);
aWriter.println("Using PrintWriter.");
aWriter.println("i = " + i + "\nd = " + d);
aWriter.println("i + d = " + (i + d));
}
}