nerdexam
Oracle

1Z0-850 · Question #4

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

The correct answer is A. Compilation fails because of an error at line 6. See the full explanation below for the reasoning.

Question

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

Options

  • ACompilation fails because of an error at line 6.
  • BCompilation fails because of an error at line 4.
  • CResult is: 40
  • DResult is: 30

How the community answered

(24 responses)
  • A
    75% (18)
  • B
    13% (3)
  • C
    8% (2)
  • D
    4% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-850 Practice