What I want is actually something like this:
public class Foo<T> {
// ...
}
public class Foo<T, S> {
// ...
}
Note that the name of the classes are the same, but the length of type list is different. The code above doesn’t work in Java, but I hope it shows my intent. Is it possible to do similar thing in Java?
Example:
public class Foo<T> {
public Integer call(T input) {
// ...
}
}
public class Foo<T, S> {
public S call(T input) {
// ...
}
}
You don’t override classes, you override methods. Classes might be subclassed.
This is possible: