I am not sure what is your question. If you are asking whether it will cause unreachable error, then no. Compiler does not know that the loop is an infinite loop.
If you like our products and services, please help us by posting your review here.
I am not sure what is your question. If you are asking whether it will cause unreachable error, then no. Compiler does not know that the loop is an infinite loop.
The only times finally won't be called are:
If you invoke System.exit();
If the JVM crashes first; If the JVM reaches an infinite loop (or some other non-interruptable, non-terminating statement) in the try or catch block;
If the OS forcibly terminates the JVM process; e.g. "kill -9 " on UNIX.
If the host system dies; e.g. power failure, hardware error, OS panic, etcetera.
If finally block is going to be executed by daemon thread and all other non daemon threads exit before finally is called.