javatutelearn.com
Easy Learning
Search Javatutelearn.com :
class Examfinal { public final void display() { System.out.println("Welcome Learner" ); } } public class test1 extends Examfinal { // trying to change display() method, but it will give error message public void display() { System.out.println("Hello World"); } public static void main(String[] args) { test1 t1 = new test1(); t1.display(); } }
/test1.java:10: error: display() in test1 cannot override display() in Examfinal
public void display() {
^
overridden method is final
1 error