Polymorphism Interview questions
1.Can we achieve method overloading by changing the return type of method only?
Ans:- in java method overloading is not possible by changing the return type of the method only because of ambiguity.
2.Can we overload java main() method()?
Ans:- yes ,we can have any number of main method overloading .this is because JVM always calls main() method which receives string arrays as arguments only.
![]() |
program 2 |
Comments
Post a Comment