- Method 1: Use label:
whileloop: { while(true) { for(String s : strings) { if("DONE".equalsIgnoreCase(s)){ break whileloop; } } } }
- Method 2: Use a boolean tag:
boolean done = false; while(!done) { for(String s : strings) { if("DONE".equalsIgnoreCase(s)){ done = true; break; } } }
No comments:
Post a Comment