public boolean strCrt(
String s){
try{
factor = Float.valueOf(s).floatValue();
return true;
}
catch(NumberFormatException e){
System.out.println("Bad number " + s);
factor = Float.NaN;
}
finally{
System.out.println("Finally");
}
return false;
}
Input ="1.2"-Result:factor = 1.2, true is returned, nothing is printed.
Input = ""-Result:factor unchanged, Finally is printed, false is returned
Input = ""-Result:factor=NaN,"Bad number finally is printed,falsed is returned
ans is C
I really don't understand this problem, anyone explain to me?