Does anybody know why the following snippet does not throw a NumberFormatException
?
public class FlIndeed {
public static void main(String[] args) {
System.out.println(new FlIndeed().parseFloat("0xabcP2f"));
}
public float parseFloat(String s) {
float f = 0.0f;
try {
f = Float.valueOf(s).floatValue();
return f;
}
catch (NumberFormatException nfe) {
System.out.println("Invalid input " + s);
}
finally {
System.out.println("It's time to get some rest");
return f;
}
}
}
Note that there is a P inside .parseFloat("0xabcP2f"));