使用equals()方法进行对象比较

时间:2020-03-01 02:56:39

标签: java random equals

equals() 如何为empId和empN编写适当的比较? 该代码需要打印随机生成的empId。

public boolean equals(empId empN){
if (this.empId.equals(empN));
Random num = new Random();//Random Number Generator
int upperbound = 9;//Generates random numbers 0 - 9
int int_random = num.nextInt(upperbound);
return "Employee ID:" +empId+ "Employee Name:" +empN;

0 个答案:

没有答案