The program works fine, but if the 3rd condition is true (i.e. the list is ordered by increasing string length), the following error occurs:
java.lang.NullPointerException
at com.codegym.task.task07.task0718.Solution.main(Solution.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
Should I write a code to not display something, or is it ok to leave with this error?
Thanks :)
Program verified correctly, but error occurs when the list is ordered by increasing string length
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Gellert Varga
6 May 2020, 19:05
Maybe you are trying to run a method on a "null" object.
I should see the program and the specific input list where this error message occurred.
0