samedi 29 février 2020

Using equals() method for Object Comparison

equals() How do I write a proper comparison for empId and empN? The code needs to print random generated 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;



Aucun commentaire:

Enregistrer un commentaire