Java Reference
In-Depth Information
A. The code does not compile.
B. 1 2 3 4 5 6 7 8 9
C. 1 2 3 4 5 6 7 8 9 10
D. 1 2 3 4 5 6 7 8 9 10 11
E. '1' an infinite number of times
13. What is the result of the following code?
7. do {
8. int y = 1;
9. System.out.print(y++ + “ “);
10. }while(y <= 10);
A. The code does not compile.
B. 1 2 3 4 5 6 7 8 9
C. 1 2 3 4 5 6 7 8 9 10
D. 1 2 3 4 5 6 7 8 9 10 11
E. '1' an infinite number of times.
14. What is the result of the following code?
5. Boolean keepGoing = true;
6. int result = 1;
7. int i = 10;
8. do {
9. i--;
10. if(i == 5) {
11. keepGoing = false;
12. }
13. result <<= 1;
14. }while(keepGoing);
15. System.out.println(result);
A. 8
B. 16
C. 32
D. 64
E. Line 14 generates a compiler error.
15. Given the following class definition:
1. public class Question15 {
2. public static void main(String [] args) {
Search WWH ::




Custom Search