Java / Modifiers
Explain strictfp keyword in Java.
The strictfp keyword is used to force the precision of floating point calculations (float or double) in Java conform to IEEE 754 standard, explicitly. Without using strictfp keyword, the floating point precision may vary depends on target platform's hardware and CPU's floating point processing capability. strictfp restricts floating-point calculations and ensuring same result on every platform while performing operations in the floating-point variable.
- The strictfp keyword can be applied for classes, interfaces and methods.
- strictfp keyword cannot be applied on abstract methods, variables or constructors.
- strictfp cannot be applied on interface methods and abstract classes.
- If an interface or class is declared with strictfp, then all methods and nested types within that interface or class are implicitly strictfp.
More Related questions...