the answer to that is always because you have an object reference that doesn't point to anything.
In your case, what is the value of i when you get to line 5?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
posted 4 years ago
Okay. Got it.. thanks for pointing. So if we use wrapper class, there won't be initialization done like i = 0. And is initialized to 'null' as any other object . So it cannot be used in any expressions before initializing it ! correct ?