我有一个代码片段:
class AutoTypeCast{
public static void main(String...args){
int x=10;
byte b=20;//no compilation error
byte c=x;//compilation error
}
}
Run Code Online (Sandbox Code Playgroud)
为什么20会自动键入式浇铸byte,而x不是?
| 归档时间: |
|
| 查看次数: |
521 次 |
| 最近记录: |