Skip to content

Instantly share code, notes, and snippets.

@frodo821
Created January 15, 2018 05:50
Show Gist options
  • Save frodo821/adea933275fef0cef3cbe0a89e5739f8 to your computer and use it in GitHub Desktop.
Save frodo821/adea933275fef0cef3cbe0a89e5739f8 to your computer and use it in GitHub Desktop.
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