Thursday, May 3, 2018

Output of the program [Method overlaoding-i]

Problem statement: Output of the program !!
  1. class MethodOverloadExe {
  2. public void run(Object o) {
  3. System.out.println("object");
  4. }
  5. public void run(String o) {
  6. System.out.println("string");
  7. }
  8. }
  9. public class OverloadingExe {
  10. public static void main(String[] args) {
  11. MethodOverloadExe m = new MethodOverloadExe();
  12. m.run(null);
  13. }
  14. }
Output:
string

No comments:

Post a Comment

Blueprint for self-improvement

To learn faster: Make the process fun To understand yourself : Write To understand the world better : Read To build deeper connection : Lis...