String.split
takes a regex, and '.' has a special meaning for regexes.
You (probably) want something like:
String[] words = line.split("\.");
Some folks seem to be having trouble getting this to work, so here is some runnable code you can use to verify correct behaviour.
import java.util.Arrays;
public class TestSplit {
public static void main(String[] args) {
String line = "aa.bb.cc.dd";
String[] words = line.split("\.");
System.out.println(Arrays.toString(words));
// Output is "[aa, bb, cc, dd]"
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…