Please explain the usage of Labeled Statements

后端 未结 3 1414
清歌不尽
清歌不尽 2020-11-27 20:50
  • Is breaking and continuing the only uses of labeled statements in Java?
  • When have you used Labeled Statements in your programs?

Sorry the c

3条回答
  •  南方客
    南方客 (楼主)
    2020-11-27 21:09

    search:
        for (i = 0; i < arrayOfInts.length; i++) {
            for (j = 0; j < arrayOfInts[i].length; j++) {
                if (arrayOfInts[i][j] == searchfor) {
                    foundIt = true;
                    break search;
                }
            }
        }
    

提交回复
热议问题