What is the result?

Given:
1. class Test {
2. public static void main(String args[]) {
3. int num;
4. num = 10;
5. calc(num);
6. System.out.println(“num = ” + num);
7. }
8.
9. static void calc(int num) { 1
0. num += 100; 11. } 12. }
What is the result?

Given:
1. class Test {
2. public static void main(String args[]) {
3. int num;
4. num = 10;
5. calc(num);
6. System.out.println(“num = ” + num);
7. }
8.
9. static void calc(int num) { 1
0. num += 100; 11. } 12. }
What is the result?

A.
num = 10

B.
num = 100

C.
Compilation fails because of an error at line 3.

D.
num = 110

E.
Compilation fails because of an error at line 9.



Leave a Reply 0

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