Examveda
Examveda

Which of the following is not a valid jump statement?

A. break

B. goto

C. continue

D. return

Answer: Option B

Solution(By Examveda Team)

Option A: break
The break statement is a valid jump statement in Java.
It is used to exit loops or switch statements prematurely, allowing the program to skip to the statement following the loop or switch block.

Option B: goto
goto is not a valid jump statement in Java.
Although "goto" is a reserved keyword in Java, it is not implemented as a feature and cannot be used to control the flow of a program.
Java designers omitted "goto" to avoid complex and unstructured code, commonly associated with its usage.

Option C: continue
The continue statement is a valid jump statement in Java.
It is used within loops to skip the current iteration and move directly to the next iteration of the loop.

Option D: return
The return statement is a valid jump statement in Java.
It is used to exit from a method and optionally return a value to the caller of the method.

Conclusion:
The correct answer is Option B: goto.
In Java, "goto" is a reserved keyword but is not implemented as a valid jump statement.

This Question Belongs to Java Program >> Operators

Join The Discussion

Comments ( 1 )

  1. Shining Star
    Shining Star :
    5 months ago

    in this question all the option are correct because all are the valid jump statement

Related Questions on Operators