I'm experimenting with String class's instance method split(). However, when I use .
as split() method's argument and trying to print it out using Arrays.toString(s2)
, only an empty array gets printed out.
Why is this happening?
String s1 = "hello.world";
String[] s2 = s1.split(".");
System.out.println(Arrays.toString(s2));