Why this code returns the error: java.lang.NullPointerException
Object obj = null;
Long lNull = null;
Long res = obj == null ? lNull : 10L;
But the following way works without any errors:
Object obj = null;
Long res = obj == null ? null : 10L;
Aucun commentaire:
Enregistrer un commentaire