DTO implementation with a Java record

Report a typo

You have a class called Product in your project:

class Product {
    private long id;
    private String model;
    private int price;
    private LocalDate dateOfArrival;
    private String vendor;

    //constructors, getters, and setters
}

Your client doesn't need the information about the product's date of arrival and its vendor. Implement the ProductDTO class considering this fact. Do it with the help of the Java record. The names and the types of fields must match the ones in the domain object.

Note that your record can't have a public modifier in this task due to the testing platform specifics.

Sample Input 1:

No input.

Sample Output 1:

Good job!
Write a program in Java 17
//implement the record below
___

Create a free account to access the full topic