Skip to content

Instantly share code, notes, and snippets.

@gunungloli666
Created March 8, 2014 15:33
Show Gist options
  • Save gunungloli666/9433567 to your computer and use it in GitHub Desktop.
Save gunungloli666/9433567 to your computer and use it in GitHub Desktop.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class TestLoop {
static BufferedReader bufferRead = new BufferedReader(
new InputStreamReader(System.in));
public static void main(String[] args) throws IOException {
A: while (true ) {
System.out.println("MASIH INGIN BERMAIN..??, ketik y");
String s = bufferRead.readLine();
if(s.equalsIgnoreCase("Y")){
B: while(true){
System.out.println("MASUKKA ANGKANYA.. !!");
String ss = bufferRead.readLine();
try{
Integer a = Integer.parseInt(ss);
if(a > 5){
System.out.println("a > 5");
continue B;
}else{
System.out.println("a < 5");
}
System.out.println("jika a < 5 , INI dieksekusi.. ");
}catch(NumberFormatException ee ){// jika bukan angka Integer yang dimasukkan
continue A;
}
}
}else{
break A;
}
}
System.out.println("MAKASIH...");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment