抱怨我有這樣的一類:javac還不能在不醒目異常(運行時異常)
/* parses a Value out of a String */
public static int parseValue(final String text) throws NumberFormatException {
String cleanedValue = text.replace("-", "").replace(",", ".");
return Math.round(Float.parseFloat(cleanedValue) * 100);
}
出於某種原因的javac不抱怨,我不趕在NumberFormatException的主叫碼。
有人能告訴我爲什麼嗎?
好的,有道理。我知道什麼是未經檢查的例外,我只是認爲這是因爲某種原因被檢查過的例外。顯然,我總是用try/catch塊包圍它直到現在。 –