- public class Test
- {
- public static void printValue(int i,int j,int k)
- {
- System.out.println("int");
- }
- public static void printValue(byte...b)
- {
- System.out.println("long");
- }
- public static void main(String... args)
- {
- byte b = 9;
- printValue(b,b,b);
- }
- }
上面代码的输出是“int”.但它应该是“长”因为字节类型参数函数已经存在.但是这里的程序正在将字节值提升为int,但情况并非如此.
有人可以澄清这里发生了什么吗?