一个简单的关于int 和short ,byte 的问题,高手请进
请教大家一个问题,,,
public class IntegerTest {
public static void main(String[] args) {
short short_test;
int int_test;
float float_test;
short_test=100;//为什么这个可以编译通过? 100默认不是int 类型的吗?
//float_test=1.2;
int_test=50;
short_test=int_test;//为什么这个就会报非运行时异常.
System.out.println(short_test);
}
百度上我也搜了 ,都没有从问题的本质出发,我想知道他们底层是怎么实现的. 顺便也分析下byte 谢谢.