Java while loop display pattern

Question

We would like to

What is the output of the following code?

public class Main {
  public static void main(String[] args) {
    int count = 1;

    while (count <= 10) {
      System.out.println(count % 2 == 1 ? "****" : "++++++++");
      ++count;/*from   ww w .j a v a  2 s  .c  o m*/
    }
  }
}


****
++++++++
****
++++++++
****
++++++++
****
++++++++
****
++++++++



PreviousNext

Related