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

Java examples for Language Basics:while

Description

What does the following program print? 3

Demo Code

public class Main 
{
   public static void main(String[] args)
   {//from  ww w . ja  v  a 2  s . c o  m
      int row = 10;

      while (row >= 1) 
      {
         int column = 1;

         while (column <= 10) 
         {
            System.out.print(row % 2 == 1 ? "<" : ">");
            ++column;
         }

         --row;
         System.out.println();
      } 
   } 
}

Result


Related Tutorials