我的問題是,爲什麼下面的程序:split()方法在java中如何工作?
// Java program to demonstrate working of split(regex,
// limit) with high limit.
public class GFG
{
public static void main(String args[])
{
String str = "[email protected]@geekss";
String [] arrOfStr = str.split("s", 5);
}
}
分割字符串"[email protected]@geekss"
到5子:。據我說,應該有4個子字符串:{"geek", "","@[email protected]", ""}
。有人能澄清我的疑問嗎?
你爲什麼不解釋你爲什麼期望獲得不同的結果? – shmosel