How to: Why does changing the returned variable in a finally block not change the return value?
How to: Why does changing the returned variable in a finally block not change the return value?
Why does changing the returned variable in a finally block not change the return value?
I have a simple Java class as shown below:
public class Test { private String s; public String foo() { try { s = "dev"; return s; } finally { s = "override variable s"; System.out.println("Entry in finally Block"); } } public static void main(String[] xyz) { Test obj = new Test();…
View On WordPress















