What is the result?

Given:
1. public class Bar {
2. int size;
3. public static void main(String[] args) {
4. Bar b = new Bar();
5. b.size = 27;
6. int i = b.go(b.size);
7. System.out.print(b.size + ” : ” + i);
8. }
9. public int go(int size) {
10. size++;
11. return size;
12. }
13. }
What is the result?

Given:
1. public class Bar {
2. int size;
3. public static void main(String[] args) {
4. Bar b = new Bar();
5. b.size = 27;
6. int i = b.go(b.size);
7. System.out.print(b.size + ” : ” + i);
8. }
9. public int go(int size) {
10. size++;
11. return size;
12. }
13. }
What is the result?

A.
27 : 28

B.
Compilation fails.

C.
27 : 27

D.
28 : 28

E.
28 : 27



Leave a Reply 0

Your email address will not be published. Required fields are marked *