String str = "a.b.c";
String[] strs = str.split("\\.");
System.out.println(strs.length);
Because under normal circumstances, "." is regarded as a regular expression of any character, plus two backslashes is the meaning of "." itself.
String str = "a.b.c";
String[] strs = str.split("\\.");
System.out.println(strs.length);
Because under normal circumstances, "." is regarded as a regular expression of any character, plus two backslashes is the meaning of "." itself.