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"); } }

浙公网安备 33010602011771号