void (int flag) { String s = ""; for(int i=0; i<10; i++) { if(i > 5) { if(s != null) { switch(flag) { case 0: s += "xyz"; break; // break switch, then break loop: effectively single concatenation case 1: s <warning descr="String concatenation '+=' in loop">+=</warning> "abc"; // fall-through case 2: s <warning descr="String concatenation '+=' in loop">+=</warning> "efg"; // continue loop: possibly multiple concatenations continue; } } break; } } System.out.println(s); }