int does not override Integer in Java

后端 未结 6 892
春和景丽
春和景丽 2020-12-11 02:23

I had a function in Java with method signature

public void myMethod (int someInt, String someString) 

in my abstract class and I had over-

6条回答
  •  离开以前
    2020-12-11 02:59

    You are correct that this scenario will not work because Java provides the functionality of the autoboxing, so at runtime JVM can not decide which method to call because it can call both method as both method fits for the argument type. So I think it will give an error or will choose either method randomly..... Just run it and see.....

提交回复
热议问题