fork download
  1. final class Main {
  2.  
  3. public static void main(String[] args) {}
  4.  
  5. // Static methods cannot be overridden, only hidden
  6. @SafeVarargs public static void method1(Object... objs) {}
  7. // Final methods cannot be overridden
  8. @SafeVarargs public final void method2(Object... objs) {}
  9. // Private methods cannot be overridden, only hidden
  10. @SafeVarargs private void method3(Object... objs) {}
  11. // Final classes cannot be subclassed, so in fact none of these methods can be overridden
  12. @SafeVarargs public void method4(Object... objs) {}
  13.  
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:10: error: Invalid SafeVarargs annotation. Instance method method3(Object...) is not final.
	@SafeVarargs private void method3(Object... objs) {}
	                          ^
Main.java:12: error: Invalid SafeVarargs annotation. Instance method method4(Object...) is not final.
	@SafeVarargs public void method4(Object... objs) {}
	                         ^
2 errors
stdout
Standard output is empty