What is the result of calling calc()?

Given:
3. int calc() {
4. long x = 40L;
5. int i = 30;
6. i = x;
7. System.out.println(“result is: ” + i);
8. }
What is the result of calling calc()?

Given:
3. int calc() {
4. long x = 40L;
5. int i = 30;
6. i = x;
7. System.out.println(“result is: ” + i);
8. }
What is the result of calling calc()?

A.
Compilation fails because of an error at line 6.

B.
Compilation fails because of an error at line 4.

C.
result is: 40

D.
result is: 30



Leave a Reply 0

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