Q:

Java getter() and setter()

can someone please tell me why I cannot use the Set properly? I managed with the Get to load the Name, Surname etc.. in the text boxes but the Set is not letting me read from the text boxes and save them. Thanks
 custnameTF.setText(bookingfile.getCustomer().getPersonName());
 custsurnameTF.setText(bookingfile.getCustomer().getPersonSurname());

customerbooking.setCustomer(.setPersonName(custnameTF.getText));

public class Booking implements Serializable{

    private String flighttime;
    private String flightlocation;
    private String flightfee;
    private boolean car;
    private boolean insurance;
    private Customer customer;

I'm trying to connect 2 classes together without an extend. I want to load and save on the Customer class through the Booking Class. Thanks

A:

First in hand, that's not the correct syntax to set.
Since that setCustomer accepts only Customer object, you need to create a Customer object and then set it to bookingCustomer.
Customer customer= new Customer();
customer.setPersonName(custnameTF.getText); // look at the correct syntax.
//set remaining properties to customer objects from text fields
// ..
//then
customerbooking.setCustomer(customer);

