Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Java for-each Loop

// print array elements 

class Main {
  public static void main(String[] args) {
      
    // create an array
    int[] numbers = {3, 7, 5, -5};
    
    // iterating through the array 
    for (int number: numbers) {
       System.out.println(number);
    }
  }
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Java #Loop
ADD COMMENT
Topic
Name
7+1 =