Skip to content

Instantly share code, notes, and snippets.

@sunmeat
Last active August 6, 2024 07:10
Show Gist options
  • Save sunmeat/236ff0114b3b9e0ee0c5 to your computer and use it in GitHub Desktop.
Save sunmeat/236ff0114b3b9e0ee0c5 to your computer and use it in GitHub Desktop.
overloading
package com.alex.methods;
public class OverloadingExample {
static void line(int length, char symbol) {
for (int i = 0; i < length; i++) {
System.out.print(symbol);
}
System.out.println();
}
static void line(int length) {
line(length, '*');
}
static void line() {
line(10);
}
public static void main(String[] args) {
line(20, '@');
line(15);
line();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment