Other | Other |
---|---|
1.1.7 b01Fixed | 1.2.0Fixed |
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
Name: el35337 Date: 05/01/98 import java.text.*; /* JDK 1.1.6 Bug, did NOT occur in 1.1.5 Possibly related to bug 4125885. This class demonstrates a regression in version 1.1.6 of DecimalFormat class. 1.1.6 Results Value 1.2 Format #.00 Result '01.20' !!!wrong Value 1.2 Format 0.00 Result '001.20' !!!wrong Value 1.2 Format 00.00 Result '0001.20' !!!wrong Value 1.2 Format #0.0# Result '1.2' Value 1.2 Format #0.00 Result '001.20' !!!wrong 1.1.5 Results Value 1.2 Format #.00 Result '1.20' Value 1.2 Format 0.00 Result '1.20' Value 1.2 Format 00.00 Result '01.20' Value 1.2 Format #0.0# Result '1.2' Value 1.2 Format #0.00 Result '1.20' */ public class JDK116Bug { public static void main(String[] args) { show(1.2, "#.00"); show(1.2, "0.00"); show(1.2, "00.00"); show(1.2, "#0.0#"); show(1.2, "#0.00"); } private static void show(double d, String s) { String result = new DecimalFormat(s).format(d); System.out.println("Value " + d + " Format " + s + " Result '" + result + "'"); } } (Review ID: 29357) ======================================================================
|