Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

final Method Java

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

class Main extends FinalDemo {
  // try to override final method
  public final 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 #Method #Java
ADD COMMENT
Topic
Name
8+8 =