🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Validation and Errors: all 10 questions

Quiz: Validation and Errors · Question 10 of 10

Which annotation checks a string against a regular expression?

Which annotation checks a string against a regular expression?

  1. A.@Size
  2. B.@Pattern(regexp = ...)
  3. C.@NotBlank
  4. D.@Min
Answer & explanation

Correct answer: @Pattern(regexp = ...)

@Pattern validates the format, such as a PIN code with exactly 6 digits.

Can you get the rest right without peeking?

Take the timed Quiz: Validation and Errors quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →