fork(94) download
  1. class Base {
  2. final public void show() {
  3. System.out.println("Base::show() called");
  4. }
  5. }
  6.  
  7. class Derived extends Base {
  8. public void show() {
  9. System.out.println("Derived::show() called");
  10. }
  11. }
  12.  
  13. class Main {
  14. public static void main(String[] args) {
  15. Base b = new Derived();;
  16. b.show();
  17. }
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:8: error: show() in Derived cannot override show() in Base
    public void show() {
                ^
  overridden method is final
1 error
stdout
Standard output is empty