How to read Array using For loop


public class OpenFile {
    public static void main(String args[]) {
        int arr[] = new int[5];

        for (int i = 0; i < arr.length; i++) {
            arr[i] = i;
            System.out.println(arr[i]);
        }
    }
}

outpu:

0
1
2
3
4

Comments

Popular posts from this blog

Multimedia search engine using python

How to sort String array by length of each string present in an array

How to program to print first non repeated character from String?