FDM Group interview question

write a java class and with the desired behavior