Create custom annotations to specify metadata that can be used to enforce validation rules or other constraints.
Source Code
@interface ValidAge {
int value() default 18;
}
class Person {
@ValidAge(21)
private int age;
// Constructor, getter, and setter
}