| 3.10 |
Which statements are true? Select the three correct answers.
|
| 3.11 |
What happens when you try to compile and run the following program?
public class Prog1 {
public static void main(String[] args) {
int k = 1;
int i = ++k + k++ + + k;
System.out.println(i);
}
}
Select the one correct answer.
|
| 3.12 |
Which is the first incorrect line that will cause a compile time error in the following program?
public class MyClass {
public static void main(String[] args) {
char c;
int i;
c = 'a'; // (1)
i = c; // (2)
i++; // (3)
c = i; // (4)
c++; // (5)
}
}
Select the one correct answer.
|
| 3.13 |
What happens when you try to compile and run the following program?
public class Cast {
public static void main(String[] args) {
byte b = 128;
int i = b;
System.out.println(i);
}
}
Select the one correct answer.
|
| 3.14 |
What will the following program print when run?
public class EvaluationOrder {
public static void main(String[] args) {
int[] array = { 4, 8, 16 };
int i=1;
array[++i] = --i;
System.out.println(array[0] + array[1] + array[2]);
}
}
Select the one correct answer.
|
![]() | A programmer's guide to Java Certification |