javastrictfp

Is the access level of strictfp class same as that of default class?


I have below 2 classes in different packages:

package chapter1.one;

strictfp class SuperClass
{
    protected void testMe()
    {
        System.out.println("Testing myself!");
    }
}


package chapter1.two;

import chapter1.one.*;

public class SubClass extends SuperClass 
{
    public void testIt()
    {
        this.testMe();
    }
    public static void main(String[] args) 
    {
        SubClass o = new SubClass();
        o.testMe();
        o.testIt();
    }
}

Ofcourse the superclass is accessible if I make it public, but when I make it strictfp (just to know what access level it supports), I get below error:

The type SuperClass is not visible.

So can I say that strictfp has the same access levels as that of default?

Here is the screenshot where I read it. enter image description here


Solution

  • strictfp is NOT an access modifier so if you don't use any along with it then the method's access level is default.

    strictfp means "strict floating points", it's used to guarantee that method will always work the same regardless of what JVM it's running on.