split method not working in java code example

Example 1: split method in java

public class SplitExample2 { 
    public static void main(String args[]) 
    { 
        String str = "My name is Chaitanya";
        //regular expression is a whitespace here 
        String[] arr = str.split(" "); 
  
        for (String s : arr) 
            System.out.println(s); 
    } 
}

Example 2: java string.split with . wont work

//Java

String sentence = "Hello World.How are you?";
String[] newSentence = sentence.split("\\.");
String firstString = newSentence[0];
String secondString = newSentence[1];
System.out.println(firstString + ' ' + secondString);