What is the purpose of `@SafeVarargs` annotation in Java?

Java Hard
Select the correct answer: Single Choice

Key points

  • `@SafeVarargs` ensures that varargs methods do not introduce heap pollution
  • It suppresses unchecked warnings for generic varargs at call sites
  • This annotation is used to maintain type safety in varargs methods

Ready to go further?