This is my code. For any kind of input i get the output 0 0 0 0 0 0 0 0 0 0 I can't understand why?
import java.util.*;
class TestArray{
int[] a=new int[10];
TestArray(){
for(int ele:a){
Scanner src=new Scanner(System.in);
ele=src.nextInt();
}
}
}
class TestArrayLoop{
public static void main(String[] args){
TestArray a=new TestArray();
for(int ele:a.a){
System.out.print(ele+" ");
}
}
}