Fun Java Facts

Thursday, April 27th, 2006 06:12 pm
flwyd: (dogcow moof!)
[personal profile] flwyd
Running JVM 1.4.2_08:
System.out.println("1 + --0 = " + new BigDecimal("1").add(new BigDecimal("--0")));
1 + --0 = 1
System.out.println("Int " + new BigDecimal("--00").intValue());
Int -1
System.out.println("Double " + new BigDecimal("--0").doubleValue());
ArrayIndexOutOfBoundsException: -1
System.out.println("BigDecimal " + new BigDecimal("--0").toString());
ArrayIndexOutOfBoundsException: -1
System.out.println("BigDecimal --42 = " + new BigDecimal("--42").toString());
NumberFormatException: Illegal digit
May 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 2025

Most Popular Tags

Expand Cut Tags

No cut tags
Page generated Monday, June 9th, 2025 09:54 am
Powered by Dreamwidth Studios