with the setting from my previous mail.
Exception in thread "main" java.lang.NullPointerException: Cannot invoke
"com.mycompany.add2strjop.Employee.getEmpName()" because* "arr[i]" is null*
at com.mycompany.add2strjop.Add2StrJOp.showRecords(Add2StrJOp.java:84)
at com.mycompany.add2strjop.Add2StrJOp.
You declare an array 0f 10 elements, but fill only three. The 4th element
(at position 3) is still null, that is where you get you null pointer.
Maybe it is a good time to:
1. switch to java 17 which has better error messages for null pointers when
you start it with -XX:+ShowCodeDetailsInExceptio
On 7/1/22 16:32, Zulfi Khan wrote:
Exception in thread "main" java.lang.NullPointerException
at com.mycompany.add2strjop.Add2StrJOp.showRecords(Add2StrJOp.java:41)