Skip to content

Instantly share code, notes, and snippets.

@VijayKrishna
Created March 18, 2015 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VijayKrishna/cf9e2c0b29b72f71bf18 to your computer and use it in GitHub Desktop.
Save VijayKrishna/cf9e2c0b29b72f71bf18 to your computer and use it in GitHub Desktop.
The embarassing existence of unconditional jumps (read goto's) in Java. It (goto) is like a zombie that refuses to just die.
public class Goto {
public static void main(String[] args) {
int count = 0;
Goto:
for(int i = 0; i < 10; i +=1) {
for(int j = 0; j < 10; j += 1) {
System.out.println("hello" + count++);
break Goto;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment