Getter/Setter from separate class file in Java
- by Crystal
I'm new to Java and for a HW assignment, we had to create a Person class that has a constructor, getter/setter for the attributes of firstName, lastName, phone. That is in a separate file from an old HW assignment (Person.java). Now we have to use that Person class in our new HW assignment (LoanApplication.java). So if one of the attributes is
private Person client
do I need to create getter/setters or a constructor again? Otherwise, how does each LoanApplicaiton instance know which Person attribute it is to go with?
How does the JVM know that it can use the Person.class even though my LoanApplicaiton.class does not extend Person.class? Thanks.