public class method_demo6 {public static void main(string[] args) {//定义不同数据类型的变量byte a = 10;byte b = 20;short c = 10;short d = 20;int e = 10; int f = 10;long g = 10;long h = 20;// 调用system.out.println(compare(a, b));system.out.println(compare(c, d));system.out.println(compare(e, f));system.out.println(compare(g, h));}
// 两个byte类型的public static boolean compare(byte a, byte b) {system.out.println("byte");return a == b;}
// 两个short类型的public static boolean compare(short a, short b) {system.out.println("short");return a == b;}
// 两个int类型的public static boolean compare(int a, int b) {system.out.println("int");return a == b;}
// 两个long类型的public static boolean compare(long a, long b) {system.out.println("long");return a == b;}
}