I don't understand why i should use {b=(byte) i} or {i =(int) d} this to conversion . Please can say me cordially why it happens in conversion. My sample code below.
public class Conversion {
public static void main(String[] args) {
byte b;
int i = 257;
double d = 323.142;
System.out.println("\n Conversion int to byt");
b = (byte) i;
System.out.println("i and b "+i+ " after "+b);
System.out.println("\n Conversion int to byt");
i = (int) d;
System.out.println("d and i "+d+ " after "+i);
}
}