Skip to main content
abstract and var-arg
- abstract methods must be implemented by a subclass, so they must be inheritable. For that reason:
- abstract methods cannot be private.
- abstract methods cannot be final.
- The native modifier applies only to methods.
- The strictfp modifier applies only to classes and methods.
- Methods with var-args
- As of Java 5, methods can declare a parameter that accepts from zero to many arguments, a so-called var-arg method.
- A var-arg parameter is declared with the syntax type... name; for instance: doStuff(int... x) { }
- A var-arg method can have only one var-arg parameter.
- In methods with normal parameters and a var-arg, the var-arg must come last.