Why does this not compile (tried with java 8 and java 10)? It yields a missing return statement error.
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.
Consider the following codeWhen running on JDK8, this code prints null whereas on JDK10 this code results in NullPointerException
For a challenge, a fellow code golfer wrote the following code:When running this code in Java 8, we get the following result: