开发者

What are nested types?

I quote from the JLS 9.1.1.2 strictfp Interfaces

"The effect of the strictfp modifier is to make all float or double expressions within the interface declaration be explicitly FP-strict. This implies that all nested types declared in the interface are implicitly str开发者_Go百科ictfp."

So, what are nested types? Does it actually means nested reference types?

UPDATE:

I meant, I need a definition of nested types.


A nested class is one declared inside another class, like this.

class SomeClass {
    class Nested {

    }
    static class StaticNested {

    }

}

You can also nest inside interfaces:

interface SomeInterface {
    class Nested {

    }
    static class StaticNested {

    }

}

The implication of this in terms of your question is if you do this:

strictfp interface SomeInterface {

or

strictfp class SomeClass {

Then when you have something inside

    class Nested {

It is implicitly

    strictfp class Nested {


An interface can have nested interface inside its definition. It implies that when you place strictfp on the interface all the nested interfaces are also strictfp.

Note: Given many JVM are strictfp by default for almost all operations, it may be hard to tell the difference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜