purpose of final method

Method declaration(in a class) can be prefixed with final keyword, if you do not want that method to be overridden.
For example wait(), notify() and notifyAll() methods in Object class are final, hence they cannot be overridden.

In below example show() method (in class A1), cannot be overridden as it is declared as final.

//final method cannot be overridden
class A1
{
final public void show()
{
System.out.println(“show() in A1”);
}
}

class B1 extends A1
{
public void show() //if show() in A1 is final, cannot be overidden, error occurs
{
System.out.println(“show() in B1”);
}
}

public class FinalDemo {
public static void main(String args[])
{
B1 ob = new B1();
}
}

You may also like to read: What is final class