error: Cannot make a static reference to the non-static method getFullName() from the type ResidentUserRegDTO

Are you sick of this error? 

Sometimes it might also be the negligence. Do you wonder? 

public ResidentUser save(ResidentUserRegDTO registrationDTO) {
		
    ResidentUser residentUser = new ResidentUser(ResidentUserRegDTO.getFullName(),
		ResidentUserRegDTO.getDateOfBirth(), ResidentUserRegDTO.getHomeAddress(),
		ResidentUserRegDTO.getEmail(), ResidentUserRegDTO.getPassword(), 
		ResidentUserRegDTO.getSniNumber());
		
    return ResidentUserRepository.save(residentUser);
} 

I accidentally used class name 'ResidentUserRegDTO' instead of object name 'registrationDTO'.

public ResidentUser save(ResidentUserRegDTO registrationDTO) {
		
    ResidentUser residentUser = new ResidentUser(registrationDTO.getFullName(),
	   registrationDTO.getDateOfBirth(), registrationDTO.getHomeAddress(),
	   registrationDTO.getEmail(), registrationDTO.getPassword(), 
	   registrationDTO.getSniNumber());
		
    return residentUserRepository.save(residentUser);
} 











Comments