Is it possible to modify the following programm by inserting some code into the marked space to make it comply to the following conditions:
- it finishes (no infinite loop)
- it does not print "Finally"?

class Clazz {
    public static void main(String[] args) { 
         for (int i = 0; i < 2; i++) { 
             try { 
                 System.out.println("Try"); 
                 // INSERT CODE HERE
             } finally { 
                 System.out.println("Finally"); 
             } 
         } 
     }
}
Explanation
It is possible. For example:
System.exit(1);
Runtime.getRuntime().halt(1);

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback