Ask Question
22 November, 01:30

The break statement is used with which statement?

A) at

B) for

C) nested if

D) switch

+1
Answers (1)
  1. 22 November, 01:36
    0
    B) for

    Explanation:

    The break statement is used in looping constructs to break out of the loop.

    for is an example of a construct used for looping n Java.

    Consider the example:

    for (int i=0; i<10; o++) {

    System. out. print (i);

    if (i==5) break;

    }

    In this case the output will consist of 012345.

    When loop variable i is equal to 5, the if condition will be satisfied and the loop breaks due to break statement.

    Note that break is also used with switch ... case blocks, but in this case it is more closely tied to the case statement.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “The break statement is used with which statement? A) at B) for C) nested if D) switch ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers