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 ".
}
}
ประเด็นจากการป้องกันไม่ให้ส่ง Byte เป็น Double คืออะไร? .. ฉันรู้ Double to Byte ด้วยเหตุผลที่แม่นยำถ้าฉันจำไม่ผิด