break;是你所需要的突破像任何循环语句的出来
for,
while或
do-while。
在您的情况下,它将是这样的:
for(int x = 10; x < 20; x++) { // The below condition can be present before or after your sysouts, depending on your needs. if(x == 15){ break; // A unlabeled break is enough. You don't need a labeled break here. } System.out.print("value of x : " + x ); System.out.print("n");}


