The first and second will be, but the third will not (due to an ambiguous method call). Why can't Java solve this situation? Why not throw # 3 at # 1?
As you already mentioned, Long can be auto-updated for a long time. However, there is ambiguity - if only the second long autobox, you will get No. 1. If both of them are autoboxes, you will receive # 2.
Since Java cannot decide which method you had in mind, this causes an error.
source share