java final modifier on method code example
Example: java final modifier on method
public class Shape {
private int numberOfVertices;
//with final modifier,
//this method cannot be overridden by subclasses
public final int getNumberOfVertices() {
return numberOfVertices;
}
}