OCA – Using Loop Constructs
What will the following code print when run? public class TestClass { public static void main(String[] args) throws Exception { String[] sa = {“a”, “b”, “c”}; for(String s : sa){ if(“b”.equals(s)) continue; System.out.println(s); if(“b”.equals(s)) break; System.out.println(s+” again”); } } } To determine the output you have to run through the loop one iteration at a … Leggi tutto