What is the function of toString in here?
what is the need for toString
誰か toString がここで何をすべきか説明してください。私はJavaが初めてで、たくさんの新しいことを学んでいます
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;
}