Is it possible to have two methods with the same name, but with different parameters and return types in Java? It seems like this would be a good way to generalize a simple getter and setter. You can do this with constructors, why not use regular methods? eg
why not be able ..
int getVal() {
return int;
}
boolean getVal() {
return true;
}
setVal(int a) {
}
and
setVal(boolean a) {
}
source
share