這里是考java的多態(tài),**到底調(diào)用了哪個(gè)函數(shù),**大家直接看下面的代碼!public class MyTest {public void hello(Object o) {System.out.println("Object");}public void hello(String str) {System.out.println("String");}public static void main(String[] args) {MyTest myTest = new MyTest();/*到底調(diào)用哪個(gè)函數(shù),為什么?*///情況1myTest.hello(null);//情況2myTest.hello("好好學(xué)習(xí),天天向上!");//情況3myTest.hello(66);//還有其他情況,我這里就不依次列舉了}}
添加回答
舉報(bào)
0/150
提交
取消