No, I canβt do it. coz somtimes in java, methods are called ignoring the return value, which is known as the "method that causes its side effects."
consider this:
void x(){} int x(){} x();
how to determine java from which x() called. therefore, overloading depending on return types is not allowed in java.
userv source share