Final class in Java

JavaJava Programming Java 8

The main purpose of using a class being declared as final is to prevent the class from being subclassed. If a class is marked as final then no class can inherit any feature from the final class.

public final class Test {
   // body of class
}
raja
Updated on 06-Feb-2020 06:06:20

Advertisements