What is the difference between NullPointerException and IndexOutOfBoundsException? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between NullPointerException and IndexOutOfBoundsException?

31st Jan 2017, 6:17 PM
Nochains
Nochains - avatar
2 Answers
+ 1
NullPointer tells that the variable/property/pointer is not initialized. indexOutOfBounds is thrown when you're trying to get value from array etc. where that index does not exist.
31st Jan 2017, 7:25 PM
Jani Sinkkonen
Jani Sinkkonen - avatar
0
thank you
31st Jan 2017, 10:30 PM
Nochains
Nochains - avatar