What does the following program print? 2 - Java Language Basics

Java examples for Language Basics:while

Description

What does the following program print? 2

Demo Code

public class Main 
{
   public static void main(String[] args)
   {/*  ww w.  j  a v a2 s  .  c o  m*/
      int count = 1;

      while (count <= 10) 
      {
         System.out.println(count % 2 == 1 ? "****" : "++++++++");
         ++count;
      } 
   } 
}

Result


Related Tutorials