0

How to assign array index to an input string in java?

For example Laptop // is entered as an input. a=sc.nextLine() I want a[0]=L a[1]=a a[2]=p . . .

12th Apr 2020, 6:37 PM
Ashutosh Mulky
Ashutosh Mulky - avatar
1 ответ
+ 3
There are many ways. The easiest would be: char[] arr = a.toCharArray();
12th Apr 2020, 6:51 PM
Denise Roßberg
Denise Roßberg - avatar