The problem is it is not throwing exception when checking ss.length, it is throwing exception in the loop, coz the first value is ss.length ie. out of range of string array coz the length is always 1 greater than the range of array.
This will remove the error and give the output as expected
Another important detail we should take into account is the following statement from K&B 6, page 363:
An exception that's never caught will cause your application to stop running.
I've modified the code as follows:
Due to the fact that Exception is propagated until the bottom of the call stack (in other words: never caught), the System.out.println("program has completed correctly") in line 6 is never reached - opposed to the scenario where Exception is caught at the right place (try-catch-block around line 5).
That's the output after running this piece of code:
Exception in thread "main" java.lang.Exception at Propagate.reverse(Propagate.java:12)