When using JSR-303 Bean Validation, where can the validation annotations be placed?

  • Only on fields within a class.
  • Only on method parameters.
  • Both on fields within a class and on method parameters.
  • Only on class-level annotations.
Validation annotations in JSR-303 can be placed both on fields within a class and on method parameters. This flexibility allows you to validate not only the data fields of a class but also method parameters to ensure that the input meets the specified constraints. The other options are not accurate; you can use validation annotations in both scenarios mentioned.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *