欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
Java|Java世界_中文論壇|ChinaJavaWorld技術(shù)論壇 : 有誰(shuí)知道nul...
Q. How does Java compiler resolve the ambiguity to decide which methods to call?
A:
In the following example, four test() methods, if we pass ambiguous \b{null} to the test, which one should (will) be called? The 3 on top has super/subclass/sub-subclass relationship. The most specific one (down hierarchy) will be called. The 4th with String as a parameter, but it is a sibling of Tester. Ambiguity compile time error results.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Tester {            void test(Object s)    { System.out.println ("Object version");    }            void test(Tester s)    { System.out.println ("Tester version");    }            void test(SubTester s) { System.out.println ("SubTester version"); }                         // Not compilable any more if you uncomment the line             // since String and Tester are siblings            // void test(String s) { System.out.println ("String version"); }                          public static void main (String args[]) {            Tester c = new Tester ();            // Ambiguous, the most specific one which fit will be call            c.test (null);         // SubTester version             c.test (new Object()); // Object version             }            }                         class SubTester extends Tester{            }            


引用原文:
Quotation from JLS2

"The informal intuition is that one method declaration is more specific than another if any invocation handled by the first method could be passed on to the other one without a compile-time type error."

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
Java 并行框架總結(Concurrent)
Java實(shí)現階1!+2!+3!+...+30!
Mock Exam II
java字符串分割
用jackson包實(shí)現json、對象、Map之間的轉換
《Java程序設計教程》05 類(lèi)和對象
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久