Sunday, 15 September 2013

Arithmetic operators in Java

Arithmetic operators in Java

I'm wondering why this code is legal and produces the output of 1
int i = (byte) + (char) - (int) + (long) - 1;
System.out.println(i);

No comments:

Post a Comment