public static void main(String[] args) {
String s1 = null;
String s2;
s1.trim(); //No compile error. But run time error
s2.trim(); //compile error.
}
In the above code there is no assignment for s1 after initialization
compiler knows s1 is null. Then why not showing compile error for s1.trim() like s2?