- A System.exit(0)
- B break
- C stop
- D end
- Share this MCQ
Answer:
B
Explanation:
To stop the execution of a construct, such as a loop or a switch statement, the correct statement is:
b) break
Explanation:
-
break
: This statement is used to exit from a loop (likefor
,while
, ordo-while
) or aswitch
statement. Whenbreak
is encountered, the execution of the loop or switch construct is immediately terminated. -
System.exit(0)
: This terminates the entire Java Virtual Machine (JVM), not just a single construct. -
stop
: This is not a valid Java statement for stopping execution. -
end
: This is not a valid Java statement for stopping execution.
Correct Answer:
b) break
Related Topic: