I always forget it, so my memo
I want to input with Scanner in Java and loop the input until the desired numerical value and character string are input. Don't think about exception handling, just a memo for processing.
rupe.java
Scanner scan = new Scanner(System.in);
while(true){
int num = scan.nextInt();
switch(num){
case //Numerical value you want to enter:
//Processing content
break;
default:
continue;
}
break;
}
Recommended Posts