public class Primitive {
public static void main(String []args) {
byte x=5;
Double y=(Double)x; //Error : Cannot cast from byte to Double.
Byte n=7;
Double m=(Double)n; //Error : cannot cast from Byte to Double.
double c=n; //working right ..."double is primitive and Byte is object ".
}
}
Apa gunanya mencegah casting Byte ke Double? .. saya tahu Double to Byte untuk alasan presisi jika saya tidak salah.