Thursday, May 3, 2018

Output of the program [method overloading-ii]

Problem statement: 
  1. class MethodOverload {}

  2. class MethodOverloadExe2 {
  3. public void run(Object o) {
  4. System.out.println("object");
  5. }
  6. public void run(MethodOverload o) {
  7. System.out.println("user data type");
  8. }
  9. }
  10. public class OverloadingExe2 {
  11. public static void main(String[] args) {
  12. MethodOverloadExe2 m = new MethodOverloadExe2();
  13. m.run(null);
  14. }
  15. }
Output:
user data type

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...