class Test {
void m1(byte b) {
System.out.print("byte");
}
void m1(short s) {
System.out.print("short");
}
void m1(int i) {
System.out.print("int");
}
void m1(long l) {
System.out.print("long");
}
public static void main(String [] args) {
Test test = new Test();
test.m1(2);
}
}
Run Code Online (Sandbox Code Playgroud)
输出为:int.为什么jvm会考虑使用int参数的方法?
| 归档时间: |
|
| 查看次数: |
125 次 |
| 最近记录: |