java重载overload

package test.day01;

public class overload2 {
public static void main(String[] args) {
System.out.println(sum(30000000L,30000000L));
}
//重载只需要对应传参
//与返回值无关
public static boolean sum(byte a, byte b) {
System.out.println("两个byte");
return a == b;
}

public static boolean sum(short a, short ui) {
System.out.println("两个short");
return a == ui;
}

public static boolean sum(int a, int b) {
System.out.println("两个int");
return a == b;
}

public static boolean sum(double a, double b) {
System.out.println("两个double");
return a == b;
}

public static boolean sum(long a, long b) {
return a == b;
}
}
posted @ 2019-10-27 23:35  cxycxycxy  阅读(174)  评论(0)    收藏  举报