Other |
---|
1.4.0 beta3Fixed |
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Name: bsC130419 Date: 08/03/2001 The constructor public BigDecimal(String val) of class java.math.BigDecimal throws StringIndexOutOfBoundsException if 'val' is the string "+". NumberFormatException expected. (JDK1.2's BigDecimal throws NumberFormatException.) Following is a test code. -------------------------------------------- import java.math.BigDecimal; public class BigDecimalTest { public static void main(String[] args) { try { BigDecimal bd = new BigDecimal("+"); } catch (Exception e) { e.printStackTrace(); } } } ------------------------------------------------ Following is a output of the test code. ------------------------------------------------ % java -version java version "1.3.0_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_01) Java HotSpot(TM) Client VM (build 1.3.0_01, mixed mode) % java BigDecimalTest java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:507) at java.math.BigDecimal.<init>(BigDecimal.java:131) at BigDecimalTest.main(BigDecimalTest.java:6) ------------------------------------------------- (Review ID: 120709) ======================================================================
|