← 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?
- A.@NotNull
- B.@NotEmpty
- C.@NotBlank
- 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 →