Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

final Class Java

// create a final class
final class FinalClass {
  public void display() {
    System.out.println("This is a final method.");
  }
}

// try to extend the final class
class Main extends FinalClass {
  public  void display() {
    System.out.println("The final method is overridden.");
  }

  public static void main(String[] args) {
    Main obj = new Main();
    obj.display();
  }
}
Source by www.quora.com #
 
PREVIOUS NEXT
Tagged: #final #Class #Java
ADD COMMENT
Topic
Name
7+7 =