I have an assignment where I have been asked to ask the user for input. What I am trying to figure out is if there is anyway to call and use methods of another class whose constructor requires parameters without passing them from the main class that will be calling said methods. i.e.
public abstract class Employee
{
private String firstName;
private String lastName;
private String socialSecurityNumber;
// three-argument constructor
public Employee( String first, String last, String ssn )
{
firstName = first;
lastName = last;
socialSecurityNumber = ssn;
} // end three-argument Employee constructor
// set first name
public void setFirstName( String first )
{
firstName = first;
} // end method setFirstName
// return first name
public String getFirstName()
{
return firstName;
} // end method getFirstName
that is a snippet of the code. In the class where the employee will be prompted to enter their firstName, is there a way to place the prompt inside the above setFirstName( String first) and then call that method without having to first pass the required arguments to the abstract employee class. New to java so my understanding is to call a method of another class you must first instaniate(sp?) an object of that class i.e. Employee sales = new Employee(). Obviously though when I do that it doesn't work because paramters are required due to the constructor. Any help would be great.