我从一些测验中获取了这段代码片段,使用 IDE 执行了它并得到了很长很长的结果,但正确的答案是Byte, Byte,为什么我得到不同的结果?该问题与 JDK 11 有关
public class Client { static void doCalc(byte... a) {
System.out.print("byte...");
} static void doCalc(long a, long b) {
System.out.print("long, long");
} static void doCalc(Byte s1, Byte s2) {
System.out.print("Byte, Byte");
} public static void main(String[] args) {
byte b = 5;
doCalc(b, b);
}
}编辑:
代码取自此处:Oracle 认证概述和示例问题 (页:13,问题:5)
萧十郎
白衣非少年
开满天机
相关分类