0
How to get an array as input in java??
3 Answers
0
I am afraid to say that i am not really sure of what you mean. If you mean that you want to get an array from the Scanner Object, then convert the String into a char array where there are many ways to do so.
for example
Scanner in = new Scanner();
return in.nextLine().toCharArray();
or instead of returning the output, just do what you need with the char array
I hope helps
happy coding
0
first initialise an array
declare an extra variable call it n for array size
loop through the size and take input from the array....like a[i]= sc.nextInt();
loop again to get the output