What is the output of the following code snippet?
public class Main{ public static void main(String[] argv){ 3: boolean checked = true; 4: int result = 15, i = 10; 5: do { 6: i--; 7: if(i==8) checked = false; 8: result -= 2; 9: } while(checked); 10: System.out.println(result); } }
D.
The code compiles without issue.
public class Main{ public static void main(String[] argv){ boolean checked = true; int result = 15, i = 10; do { /*from www . j a va 2 s . c om*/ i--; if(i==8) checked = false; result -= 2; } while(checked); System.out.println(result); } }