标签:
请看以下代码,你发现有什么特殊之处吗?
public class MethodOverload {
public static void main(String[] args) {
System.out.println("The square of integer 7 is " + square(7));
System.out.println("\nThe square of double 7.5 is " + square(7.5));
}
public static int square(int x) {
return x * x;
}
public static double square(double y) {
return y * y;
}
}
答:两个函数的参数类型,参数个数和参数顺序都不一样。
标签:
原文地址:http://www.cnblogs.com/Conqueredcba/p/5962910.html