卓嗨网,似奶年华,柏元崇
/* 题目要求: 比较两个数据是否相等, 参数类型分别是byte,short,int,long 然后在main方法中测试 */ public class helloworld { public static void main(string[] args) { byte x = 10; byte y = 20; system.out.println(sum(x, y)); system.out.println(sum((short) 20, (short) 20)); system.out.println(sum(20, 10)); system.out.println(sum(20l,10l)); } public static boolean sum(byte x, byte y) { if (x == y) { return true; } else { return false; } } public static boolean sum(short x, short y) { boolean sum = x == y ? true : false; return sum; } public static boolean sum(int x, int y) { return x == y; } public static boolean sum(long x, long y) { boolean max; if (x == y) { max = true; } else { max = false; } return max; } }
/* 题目要求: 比较两个数据是否相等, 参数类型分别是byte,short,int,long 然后在main方法中测试 */ public class helloworld { public static void main(string[] args) { byte x = 10; byte y = 20; system.out.println(sum(x, y)); system.out.println(sum((short) 20, (short) 20)); system.out.println(sum(20, 10)); system.out.println(sum(20l,10l)); } public static boolean sum(byte x, byte y) { if (x == y) { return true; } else { return false; } } public static boolean sum(short x, short y) { boolean sum = x == y ? true : false; return sum; } public static boolean sum(int x, int y) { return x == y; } public static boolean sum(long x, long y) { boolean max; if (x == y) { max = true; } else { max = false; } return max; } }
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
浅析我对 String、StringBuilder、StringBuffer 的理解
使用IDEA搭建SSM框架的详细教程(spring + springMVC +MyBatis)
Springboot整合freemarker 404问题解决方案
引入mybatis-plus报 Invalid bound statement错误问题的解决方法
网友评论