Some Unknown Facts

Friday, March 5th, 2004 01:52 pm
flwyd: (spam lite)
[personal profile] flwyd
Fun with Java:

System.out.println(1 + 2 + "foo" + 4 + 5);
3foo45
System.out.prinln(1 - 2 + "foo" + 4 + 5);
-1foo45
System.out.println(1 + 2 + "foo" + 4 - 5);
syntax error
System.out.println(1 + 2 + "foo" + 4 * 5);
3foo20
System.out.println(2.0 * 3 / 4 + " (double first)");
1.5 (double first)
System.out.println(3 / 4 * 2.0 + " (double last)");
0.0 (double last)


The wonders of selective operator overloading.
December 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, December 29th, 2025 06:23 pm
Powered by Dreamwidth Studios