return type

publicfloat parseFloat( String s )

{

float f = 0.0f;

try

{

f = Float.valueOf( s ).floatValue();

return f ;

}

catch(NumberFormatException nfe)

{

f = Float.NaN ;

return f;

}

finally

{

f = 10.0f;

return f;

}

}

In the above code irrespective of whether exception is thrown or not we have 2 return types. finally is always executed, so does that mean that return of try and catch will not be executed?

[1023 byte] By [jaaya] at [2007-10-3 7:02:58]
# 1
Hai,Yes that is true.In this method always the return value of this function will be 10.0f as mentioned in the finally blockrgds,rdRose
RedRoseDiscussion05a at 2007-7-15 1:56:19 > top of Java-index,Java Essentials,New To Java...