April 2018
Intermediate to advanced
910 pages
33h 21m
English
In Java 9, we can use the @SafeVarargs annotation with private instance methods. When we use this annotation, we are asserting that the method does not contain any harmful operations on the varargs passed as parameters to the method.
The syntax for usage is:
@SafeVarargs // this is the annotation static void methodName(...) { /* The contents of the method or constructor must not perform any unsafe or potentially unsafe operations on the varargs parameter or parameters. */ }
Use of the @SafeVarargs annotation is restricted to: