Hello, I had a task from my book to write this code
public class EkspKonverzija
{
public static void main(String args[])
{
byte b;
int i=257;
double d= 323.142;
b=(byte) i;
System.out.println("i and b "+i+" "+b);
i=(int) d;
System.out.println("d and i "+d+" "+i);
b=(byte) d;
System.out.println("b and d "+b+" "+d);
}
}
And the result:
i and b 257 1
d and i 323.142 323
d and b 323.142 67
I understand why the result of the first conversion is 1, and I also understand the second conversion, but I'm not sure why this is the result of 67 at the last conversion, I can’t understand this, so I need your help. Thanks
user3266796
source
share