Strictfp Keyword in Java

strictfp is a keyword in Java which is used to ensure that we will get the same result or output in each platform if the operation is performed on a floating point variable.

Sometimes we get system dependent results and hence results may vary by platforms. To overcome this strictfp keyword is introduced.

This keyword can be applied on class level, interface level, and method declaration level.

Class level

strictfp class A{} // class declaration

Interface level

strictfp interface M{}// interface declaration

Method Level

class B{  
strictfp void show(){}//Method level