After trying to delve a bit into the mechanics behind cases such as this question brings into light, I still don't understand why the third line in the code below generates only a warning while the second line is an error.
This question already has an answer here:Certain common programming languages, most notably C and C++, have the strong notion of undefined behaviour: When you attempt to perform certain operations outside of the way they are intended to be used, this causes undefined behaviour.
I recently installed jdk10. I was doing normal code and it is not working.Am I doing something wrong here? Please see the code and Exception stacktrace. As far as I understand there should be no reason for such behaviour.