你可以
labelwhile循环,并
break在
labeled loop,这应该是这样的:
loop: while(sc.hasNextInt()){ typing = sc.nextInt(); switch(typing){ case 0: break loop; case 1: System.out.println("You choosed 1"); break; case 2: System.out.println("You choosed 2"); break; default: System.out.println("No such choice"); }}而且
label可以是你想要的任何字,例如
"loop1"。



