🎙 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 4 of 10

Which annotation rejects a string that is null, empty or only spaces?

Which annotation rejects a string that is null, empty or only spaces?

  1. A.@NotNull
  2. B.@NotEmpty
  3. C.@NotBlank
  4. D.@Size(min = 0)
Answer & explanation

Correct answer: @NotBlank

@NotEmpty would accept " "; @NotNull would accept "".

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 →