When splitting with a string literal delimiter, the safest way is to use the Pattern.quote() method:
String[] words = line.split(Pattern.quote("."));
As described by other answers, splitting with "\\."
is correct, but quote()
will do this escaping for you.