View RSS Feed

Java Object

Object-oriented programming in Java.

  1. Overloading on return values

    by , 04-26-2012 at 06:39 PM
    It is commonly wondered that why method argument & class names lists? Why methods shall not be distinguished ,based at return values? E.g, two methods having similar arguments and name get distinguished quite easily from each other:

    void f() {}
    int f() {}

    It will be working fine if unequivocally a compiler finds out the meaning, as in int x = f( ). But, a method could be called and return value can be ignored; which is referred as method calling for sideeffects, ...