overload

 

 

public class TT {
    public static void main(String[] args) {
        TT tt = new TT();        
        Byte b = null;
        tt.test(b); //OK
        
        //tt.test(null); //compile error
        
        Byte c = 3;
        Object object = c;
        //tt.test(object); //compile error    
    }

    public void test(String str) {
        System.out.println("str");
    }

    public void test(Byte b) {
        System.out.println("b");
    }
}

 

posted @ 2015-03-24 16:14  牧 天  阅读(156)  评论(0)    收藏  举报