Text is to learn the network of articles on the summary, thank you for your selfless sharing.
Java does not provide a goto feature, but it retains the goto keyword. In Java, you can use the break label and the continue label feature to implement the Goto feature in a simple version.
Here's a little code to make a tip.
Package se;/** * * <p> * Description: Use the TAB function of break and Continue * </p> * @author Zhangjunshuai * @version 1.0 * C reate date:2014-10-16 pm 4:11:39 * Project name:java7thread * * <pre> * Modification History: * Date Author Version Description *---------------------------------- -------------------------------------------------------------------------* Lastchange: $Date:: $ $Auth Or: $ $Rev: $ * </pre> * */public class Breakgoto {/** * <p> * </p> * * @author Zhang Junshuai * @date 2014-10-16 pm 3:28:53 * @param args */public static void main (string[] args) {Boolean t = True;first: {sec Ond: {//break must be in the tag, you can not jump out of the unrelated label so that no label third: {System.out.println ("before the break."); if (t) break second; Break off of second//blockSystem.out.println ("This won ' t execute");} System.out.println ("This won ' t execute");} con:for (int j = 0; J < 4; J + +) {for (iNT i = 0; I < 10; i++) {System.out.println ("---jump---" +i+j); continue con;//here is a loop that jumps out of I, jumping to the J Loop}}system.out.println ("This was after Second block. ");} No:{system.out.println ("No");}}}
Reference:
http://blog.csdn.net/jamesfancy/article/details/1198210
http://zhangkun716717-126-com.iteye.com/blog/933836
Java se break and Continue tags