I'm trying to find out how to make separate toString methods based on an overloaded constructor. Take the below code for example:
public class Employee {
     private double salary;
     private String name;
     public Employee(String name) {
          this.name = name;
     }
     public Employee(String name, int salary) {
          this.name = name;
          this.salary = salary;
     }
}
Now, I would like to implement a toString method that is dependent on the object created and output the corresponding values.(i.e. one that outputs just name, the other that outputs name and salary) Do I need only one toString method and need to add an if-else statement?
Sorry if this is a silly question, I'm just learning the ropes of Java.
 
     
     
    