Taking multiple input in single line separated by spaces

how can i take multiple input in single line in that is separated by spaces and is stored in array?

@amoghsachdeva3
you can use for loop to assign values in an array.
Scanner scn=new Scanner(System.in);
int a[] =new int[n]
for(int i=0;i<n;i++){
a[i]=scn.nextInt();
}

where n =size of the array

it is working …thanks

@amoghsachdeva3
please mark your doubt as resolved in my doubt section and rate me as well :blush: