How to process Arrays in Java?
Answers
Answered by
1
Answer:
Explanation:
To process array elements, we often use either for loop or for each loop because all of the elements in an array are of the same type and the size of the array is known. Suppose we have an array of 5 elements we can print all the elements of this array as:
Example
- Live Demo
public class ProcessingArrays {
public static void main(String args[]) {
int myArray[] = {22, 23, 25, 27, 30};
for(int i = 0; i<myArray.length; i++) {
System.out.println(myArray[i]);
}
}
}
- Output
22
23
25
27
30
aman95858:
hiii
Similar questions
English,
6 months ago
CBSE BOARD X,
6 months ago
Accountancy,
6 months ago
Computer Science,
11 months ago
Biology,
1 year ago
Biology,
1 year ago