Skip to content

Instantly share code, notes, and snippets.

@Devansh-Maurya
Last active September 30, 2018 03:41
Show Gist options
  • Save Devansh-Maurya/5ff1e18aef2faf1279d12fec395f7c3a to your computer and use it in GitHub Desktop.
Save Devansh-Maurya/5ff1e18aef2faf1279d12fec395f7c3a to your computer and use it in GitHub Desktop.
Example showing how final prevents method overriding
class A {
final void meth() {
System.out.println("This is a final method");
}
}
class B extends A {
void meth() { // ERROR! Can't override.
System.out.println("Illegal!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment