.split() 函数是否存在?当我输入:
public class Main {
public static void main(String[] args) {
String numbers = "1, 2, 3, 4, 5";
int[] numbers2 = (int[]) numbers.split(", ");
System.out.println(numbers2);
}
}
Run Code Online (Sandbox Code Playgroud)
它说:
Main.java:4: error: incompatible types: String[] cannot be converted to int[]
int[] numbers2 = (int[]) numbers.split(", ");
^
1 error
Run Code Online (Sandbox Code Playgroud)