Created
January 15, 2018 05:50
-
-
Save frodo821/adea933275fef0cef3cbe0a89e5739f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Overload{ | |
public static void Main(String args[]){ | |
method(1); | |
method("abc"); | |
method(1, 2) | |
} | |
void method(int a){ | |
System.out.println(a); | |
System.out.println("Integer"); | |
} | |
void method(String a){ | |
System.out.println(a); | |
System.out.println("String"); | |
} | |
void method(int a, int b){ | |
System.out.println(a + b); | |
System.out.println("Two integers"); | |
} | |
} | |
/** expected output | |
* 1 | |
* Integer | |
* abc | |
* String | |
* 3 | |
* Two integers | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment