LearnFrenzy
Sign in Take a free test

Control Flow Statements · Control Flow MCQ · Question 18

Statements after break or return Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 18 Back to Exercise

What does javac do with a statement written directly after return; in the same block?

  • A Ignores it
  • B Reports an "unreachable statement" error Correct
  • C Runs it before returning
  • D Warns but compiles
Correct Answer: Option B

Unreachable statements are compile errors in Java.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links