Java 14 introduced an enhancement to NullPointerException messages that provides more detailed information about the source of the null reference. This feature can help developers to quickly identify and fix null pointer errors.
Example:
String str = null;
int length = str.length(); // Throws NullPointerException with enhanced message