Bloomberg LP Interview Question
Software Engineer / Developerspublic class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("The return value is : " + returnTest() );
}
public static int returnTest() {
try {
return 10;
} finally {
return 20;
}
}
}
It prints 20..
Padmanabha Reddy Kolagatla for bloomberglaw.com
I do not know how Pinky Deewani became manager
They make you work 10 to 12 hours and pay only 8 hrs, crappy architecture, any one line of code you change, you have using free jetty and it takes 30 minutes.
I wonder the great mayor M. Doomsberg knows about his shitty company
is NOT executed in only 2 cases: JVM crash and a System.exit() call before it can be reached.
- TY February 04, 2010In this case, first the return value of 10 will be encountered but when the finally block is executed, the return there will provide the actual return value.
In short, 20 will be returned, not 10.
P.S. Bad practice and should not ever be used except as a thought exercise.