Java Reference
In-Depth Information
C. BufferedOutputStream
D. DataOutputStream
E. PrintWriter
F. PipedOutputStream
12. What is output of the following code?
5. PrintWriter pw = new PrintWriter(System.out);
6. double d = 2.73258;
7. int x = 3;
8. pw.format(“%4.2f%s %d%n”, d, “ is almost”, x);
9. pw.close();
A. 2.73 is almost 3
B. 2.73 is almost3
C. 02.73 is almost 3
D. 2.733 is almost 3
E. There is no output.
13. What is the result of the following code?
7. PrintWriter pw = new PrintWriter(System.out);
8. pw.format(“%2$d is bigger than %2$d”, 10, 5);
9. pw.close();
A. 10 is bigger than 5
B. 5 is bigger than 10
C. 10 is bigger than 10
D. 5 is bigger than 5
E. Line 8 generates a compiler error.
14. Given the following program:
1. import java.io.*;
2.
3. public class Employee {
4. private String name;
5. private float salary;
6. private int id;
7.
8. public Employee(String name, float salary, int id)
9. {
10. this.name = name;
Search WWH ::




Custom Search