What can be done to get the following code compile and run?
public float parseFloat(
String s )
{
float f = 0.0f; // 1
try
{
f = Float.valueOf( s ).floatValue(); // 2
return f ; // 3
}
catch(NumberFormatException nfe)
{
f = Float.NaN ; // 4
return f; // 5
}
finally {
return f; // 6
}
return f ; // 7
}
I thought the unreachable statements were //7 after return in finally, //4 //5 as they may not be reached if not exception is thrown.
Can someone explain which all are unreachable and why???