Skip to content

Instantly share code, notes, and snippets.

@ntcho
Last active April 10, 2017 00:18
Show Gist options
  • Save ntcho/55be67e1e2a97ae1b2fced2e1d389536 to your computer and use it in GitHub Desktop.
Save ntcho/55be67e1e2a97ae1b2fced2e1d389536 to your computer and use it in GitHub Desktop.
Java loops
public static void main(String args[]) {
int i = 0, j = 0, k = 0;
// for statement
for (i = 0; i < 5; i++) {
print(i);
}
// while statement
while (j < 5) {
print(j++);
}
// do while statement
do {
print(k++);
} while (k < 5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment