Code
package com;
public class Employee {
private String name;
private String empId;
public Employee(String name, String empId) {
super();
this.name = name;
this.empId = empId;
}
// equals and hashcode
}
package com;
import java.util.LinkedHashSet;
import java.util.Set;
public class TestEmp {
public static void main(String[] args) {
Employee emp1 = new Employee("Luke", "11");
Employee emp2 = new Employee("Luke2", "12");
Set<Employee> empSet = new LinkedHashSet<>();
empSet.add(emp1);
empSet.add(emp2);
Object obj[] = empSet.toArray();
System.out.println(obj);
}
}
When i print i get the response it is showing as [Ljava.lang.Object;@7852e922
I need response in form of an Employee Array , can you please help how to get this in form of an array
The response needs to form of an Array of Employees