我正在尝试将用户输入从扫描仪读取到整数数组中,目前有:
int [] arr1 = {Integer.parseInt(sc.nextLine().split(" "))};
但是我得到了错误
String[] cannot be converted to String
Any help would be much appreciated :)
我正在尝试将用户输入从扫描仪读取到整数数组中,目前有:
int [] arr1 = {Integer.parseInt(sc.nextLine().split(" "))};
但是我得到了错误
String[] cannot be converted to String
Any help would be much appreciated :)
试试下面的代码:
Check the document:
API: Integer.parseInt String.split()