The relationship of overload and method return type in Java?
问题 If there are two methods, they have different parameters, and their return types are different . Like this: int test(int p) { System.out.println("version one"); return p; } boolean test(boolean p, int q) { System.out.println("version two"); return p; } If the return types are same, of course this is overload . But since the return types are different , can we regard this as overload still? 回答1: consider following points for overloading: First and important rule to overload a method in java is