Is there a goto statement in Java?

前端 未结 23 2518
醉酒成梦
醉酒成梦 2020-11-22 04:50

I\'m confused about this. Most of us have been told that there isn\'t any goto statement in Java.

But I found that it is one of the keywords in Java. Where can it be

23条回答
  •  面向向阳花
    2020-11-22 05:38

    So they could be used one day if the language designers felt the need.

    Also, if programmers from languages that do have these keywords (eg. C, C++) use them by mistake, then the Java compiler can give a useful error message.

    Or maybe it was just to stop programmers using goto :)

提交回复
热议问题