QuestionQ171

Using Loop Constructs

Given the following code fragment:

Question Image

What is the result?

  • A 5 : 5
  • B 10 : 10
  • C 5 : 10
  • D Compilation fails.
Explanation

A Java field declaration must end with a semicolon. Because static int count = 0 has no terminating semicolon, compilation fails before the program can run.

Community Discussion

No comments yet. Be the first to start the discussion!