Java Keyword Strictfp

The reserved keyword strictfp is used to restrict the precision and rounding on a floating point calculation to ensure platform portability. The Java strictfp keyword ensures that your application will get the same result on every platform when performing operations on floating point variables.

The strictfp keyword can be applied on Java methods, Java classes and Java interfaces. The strictfp keyword can’t be applied to a Java variable.

The sample code below defines a Java class using the strictfp keyword identifier so all floating point calculations that occur within the class will be standard on all platforms.

//JavaCodeDepot Sample 

strictfp class JavaCodeDepotStrictClass {
 
    //Do some wicked cool Java class actions here...
}


The sample code below defines a Java interface using the strictfp keyword identifier so all floating point calculations that occur within the interface will be standard on all platforms.

//JavaCodeDepot.com Sample 

strictfp interface JavaCodeDepotStrictInterface {
 
    //Do some wicked cool Java interface actions here...
}


The sample code below defines a Java class that includes a strictfp method so all floating point calculations that occur within the method will be standard on all platforms.

//JavaCodeDepot Sample 

class JavaCodeDepotClass {
 
    //Define method with strictfp
    strictfp void veryStrictMethod() {

        //Do some insane Java processing.....
    }
}


The complete list of Java reserved keywords contains a total of 50 keywords and 3 literal words that are unable to be used as variable names.

Add a Comment

Your email address will not be published. Required fields are marked *