Complete the code to declare a simple DTO class field.
private [1] name;The DTO field for a name is typically a String to hold text data.
Complete the code to convert an entity to a DTO in a method.
return new UserDTO(entity.get[1]());
The method getName() retrieves the name from the entity to pass to the DTO.
Fix the error in the DTO constructor parameter type.
public UserDTO([1] name) { this.name = name; }The constructor should accept a String for the name, not an Entity or other type.
Fill both blanks to map entity fields to DTO fields correctly.
dto.setName(entity.get[1]()); dto.setEmail(entity.get[2]());
Mapping entity's getName() and getEmail() to DTO fields ensures data separation.
Fill all three blanks to create a DTO from entity fields with proper types.
public record UserDTO([1] name, [2] email, [3] age) {}
UserDTO uses String for name and email, and int for age to keep simple data types.
