gpt4 book ai didi

java - 拳击+Varargs 优于拳击+加宽

转载 作者:行者123 更新时间:2023-12-02 07:34:01 24 4
gpt4 key购买 nike

如有错误,请指正。Boxing+Varargs 是否优于 Boxing+Widening?

我在site中找到了那是另一种方式。

最佳答案

当多个可以符合条件时调用什么方法在 JLS #15.2.2 中定义:

The first phase (§15.12.2.2) performs overload resolution without permitting boxing or unboxing conversion, or the use of variable arity method invocation. If no applicable method is found during this phase then processing continues to the second phase.

The second phase (§15.12.2.3) performs overload resolution while allowing boxing and unboxing, but still precludes the use of variable arity method invocation. If no applicable method is found during this phase then processing continues to the third phase.

The third phase (§15.12.2.4) allows overloading to be combined with variable arity methods, boxing, and unboxing.

总结一下:加宽 > 装箱&拆箱 > 可变参数

关于java - 拳击+Varargs 优于拳击+加宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12510396/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com