What is the function of toString in here?
what is the need for toString
can anyone please explain what toString suppose to do here. I am new in java and learning alot of new stuff
public class Employee
{
private String name;
private String address;
private int number;
public Employee(String name, String address, int number)
{
System.out.println("Constructing an Employee");
this.name = name;
this.address = address;
this.number = number;
}
public String toString() //what is this function doing
{
return name + " " + address + " " + number;
}