Java Reference
In-Depth Information
A. onetwothree
B. onetwothree2
C. onetwothree3
D. onetwothree4
E. The code does not compile.
8. What is the output of the following program?
1. public class Average {
2. public static void main(String [] args) {
3. int [] scores = {2,4,5,5,6,8};
4. int sum = 0;
5. for(int x : scores) {
6. sum += x;
7. }
8. System.out.println(sum / scores.length);
9. }
10. }
A. 30
B. 6
C. 4
D. 5
E. The code does not compile.
9. What is the output of the following code?
5. int count = 0;
6. rowloop : for(int row = 1; row <= 3; row++) {
7. for(int col = 1; col <= 2; col++) {
8. if(row * col % 2 == 0)
9. continue rowloop;
10. count++;
11. }
12. }
13. System.out.println(count);
A. 1
B. 2
C. 3
D. 4
E. 6
Search WWH ::




Custom Search