Complete the code to set a minimum value constraint on the age field.
@Min([1])
private int age;The @Min annotation sets the minimum allowed value for a numeric field. Here, 18 means age cannot be less than 18.
Complete the code to set a maximum value constraint on the score field.
@Max([1])
private int score;The @Max annotation sets the maximum allowed value. Here, 100 means the score cannot exceed 100.
Fix the error in the code by completing the annotation to restrict quantity between 1 and 10.
@Min(1) @Max([1]) private int quantity;
The @Max annotation should be 10 to restrict quantity between 1 and 10 inclusive.
Fill both blanks to create a field 'rating' that must be between 1 and 5 inclusive.
@Min([1]) @Max([2]) private int rating;
The rating must be at least 1 and at most 5, so @Min(1) and @Max(5) are correct.
Fill all three blanks to define a field 'level' with minimum 0, maximum 10, and default value 5.
@Min([1]) @Max([2]) private int level = [3];
The field 'level' must be between 0 and 10, so @Min(0) and @Max(10) are used. The default value is set to 5.