Java label irregularity (possible bug?)

回眸只為那壹抹淺笑 提交于 2019-12-01 03:40:06

The expression

int k = 3; 

is a local variable declaration statement.

The statement used in the syntax of a label statement

LabeledStatement:

  Identifier : Statement

does not contain local variable declaration statements. You therefore can't use them within a labeled statement directly.

Local variable declaration statements can be used within blocks which can be used within labeled statements.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!