Java Reference
In-Depth Information
6. System.out.println(“Success”);
7. } else {
8. System.out.println(“Failure”);
9. }
A.
Success
B.
Failure
C.
Line 4 generates a compiler error.
D.
Line 5 generates a compiler error.
20.
What is the output of the following code?
5. int c = 7;
6. int result = 4;
7. result += ++c;
8. System.out.print(result);
A.
8
B.
11
C.
12
D.
15
E.
16
F.
Line 7 generates a compiler error.
21.
Determine the output of the following code when executed with the command:
java HelloWorld hello world goodbye
1. public static class HelloWorld {
2. public static void main(String [] args) {
3. System.out.println(args[1] + args[2]);
4. }
5. }
A.
hello world
B.
world goodbye
C.
null null
D.
An ArrayIndexOutOfBoundsException occurs at runtime.
E.
The code does not compile.
Search WWH ::
Custom Search