No Exception while type casting with a null in java
You can cast null to any reference type without getting any exception. The println method does not throw null pointer because it first checks whether the object is null or not. If null then it simply prints the string “null”. Otherwise it will call the toString method of that object. Adding more details: Internally print … Read more