Java OCA OCP Practice Question 3197

Question

What will be printed when the following program is run?

public class Main {
  public static void main(String[] args) {
    for (int i = 12; i > 0; i -= 3)
      System.out.print(i);
    System.out.println("");
  }
}

Select the one correct answer.

  • (a) 12
  • (b) 129630
  • (c) 12963
  • (d) 36912
  • (e) None of the above.


(c)

Note

The loop prints out the values 12, 9, 6, and 3 before terminating.




PreviousNext

Related