-1

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

Touhid K.
  • 351
  • 1
  • 5
  • 23
  • Where did you get the idea that `strictfp` has anything to do with access control? Have you reserched the meaning of that modifier at all? – Marko Topolnik Dec 10 '14 at 11:28
  • @Marko Topolnik I have edited my post. – Touhid K. Dec 10 '14 at 11:35
  • 1
    What do you think "Nonaccess" means in the image you posted. It is not an access modifier. – Mark Rotteveel Dec 10 '14 at 11:39
  • 2
    If you take care to read the screenshot, you should notice that these are *class modifiers*, not *access modifiers*. Be very careful to read each word, especially the word "Nonaccess" in plain sight on that screenshot. – Marko Topolnik Dec 10 '14 at 11:39
  • I also got the thing that, "IF I DONT ASK SUCH QUESTION (HOWEVER SILLY IT MAY BE and AS MUCH I GET DOWN VOTED FOR IT), I WONT **LEARN**. Happy. :) – Touhid K. Dec 11 '14 at 04:07

1 Answers1

3

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.

Lucas
  • 3,181
  • 4
  • 26
  • 45