Answers for "while loop + java"

2

while loop in java

// Iterate Array using while loop
public class ArrayWhileLoop
{
   public static void main(String[] args) 
   {
      int[] arrNumbers = {2, 4, 6, 8, 10, 12};
      int a = 0;
      System.out.println("Printing even numbers: ");
      while(a < 6)
      {
         System.out.println(arrNumbers[a]);
         a++;
      }
   }
}
Posted by: Guest on November-21-2020
2

while loop in java

// Iterate Array using while loop
public class ArrayWhileLoop
{
   public static void main(String[] args) 
   {
      int[] arrNumbers = {2, 4, 6, 8, 10, 12};
      int a = 0;
      System.out.println("Printing even numbers: ");
      while(a < 6)
      {
         System.out.println(arrNumbers[a]);
         a++;
      }
   }
}
Posted by: Guest on November-21-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language