Question: I am struggling with setting up the nested class in java. for example I have a person class which contains first and last name and
I am struggling with setting up the nested class in java. for example I have a person class which contains first and last name and it contains getters/setters. Then have another class company which has person class inside it. Please advise me how to set up the getters and setters of that person class inside the company class. Because if I do
public Person getPerson(string first, string last){ return new Person(person); } public void setPerson(){ Person = new Person (first, last)
and then try to reset the value in my main class, company.setPerson().set first(); it gives me an error
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
