Answers for "while loop java example"

4

what is a do while loop in java

do {
  //something you want to execute at least once
} while (someBooleanCondition);
Posted by: Guest on November-10-2020
0

While looping in java

int number = 1;

while(number < 10){
  System.out.println(number);
  number += 1;
}
Posted by: Guest on July-26-2021
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