J2K: replace overloads with optional parameters not only for constructors but for methods too
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
class A {
|
||||
void foo(int i, char c, String s) {
|
||||
System.out.println("foo" + i + c + s);
|
||||
}
|
||||
|
||||
void foo(int i, char c) {
|
||||
foo(i, c, "");
|
||||
}
|
||||
|
||||
void foo(int i) {
|
||||
foo(i, 'a', "");
|
||||
}
|
||||
|
||||
int bar(String s) {
|
||||
System.out.println("s = " + s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bar() {
|
||||
return bar(null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user