Jump Statements

Jump statements unconditionally transfer program control within a function. Java has three Jump statements: break, continue and return. Jump statement skips rest of the loops and jumps over to the statement following the loop. Break statement in Java programming is used to jump out of the loop control statements. Breaking a loop instructs the program to immediately quit the current iteration and go to the first statement following the loop. The continue statement is used to move control to the start of the next repetition. Continue statement enables a program to skip over a part of the code and causes the next iteration of the loop. The return statement returns the value to the calling code. The continue statement is used when we want to skip the rest of the statements in the body of the loop and continue with the next iteration of the loop.

Java provides a mechanism to label a block of statements. A label is any valid Java variable name. The return statement in a loop instructs the program to immediately quit the current method and return to the calling method.

To Access the full content, Please Purchase

  • Q1

    Write the statement that is used to skip over the part of a code.

    Marks:1
    Answer:

    break’ statement

    View Answer
  • Q2

    Write the statement which is used to skip a part of the loop.

    Marks:1
    Answer:

    ‘continue’ statement

    View Answer
  • Q3

    How can you tell whether a loop has executed break statement or not?

    Marks:1
    Answer:

    One can tell whether a loop has executed break statement or not by examining the loop variable.

    View Answer
  • Q4

    What are the various types of jump statements provided by Java?

    Marks:1
    Answer:

    Java provides three kinds of jump statements: return, break and continue.

    View Answer
  • Q5

    Define jump statements.

    Marks:1
    Answer:

    Jump statements are the statements that unconditionally transfer program control to another part of the program.

    View Answer