What is the difference between final and abstract?
For abstract methods compulsory we should override in the child class to provide implementation. Whereas for final methods we can’t override hence abstract final combination is illegal for methods.
For abstract classes we should compulsory create child class to provide implementation whereas for final class we can’t create child class. Hence final abstract combination is illegal for classes.
Final class cannot contain abstract methods whereas abstract class can contain final method.
abstract class A
public final void methodOne(K
valid
Note:
practice.
• Usage of abstract methods, abstract classes and interfaces is always good programming
Example:
strictfp is the modifier applicable for methods and classes but not for variables.
Strictfp modifier introduced in 1.2 versions.
If a method declare as the Strictfp then all the floating point calculations in that method has to follow IEEE754 standard. So that we will get flat from independent results.