Skip to content

Instantly share code, notes, and snippets.

@s1monw1
Created September 2, 2022 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s1monw1/c531b46cf2153d869684de73f7a1239d to your computer and use it in GitHub Desktop.
Save s1monw1/c531b46cf2153d869684de73f7a1239d to your computer and use it in GitHub Desktop.
public class Overloader {
public void test(int a, boolean printToConsole) {
if (printToConsole) {
System.out.println("int a: " + a);
}
}
public void testWithoutPrint(int a) {
test(a, false);
}
public void test(int a) {
test(a, true);
}
public static void main(String[] args) {
Overloader o = new Overloader();
o.testWithoutPrint(2);
o.test(2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment