开发者

How to avoid inner class' name collision?

开发者 https://www.devze.com 2023-02-28 03:45 出处:网络
If I have a class A and a class B which is A\'s inner class. Also I have another class B. It\'s not in A.

If I have a class A and a class B which is A's inner class. Also I have another class B. It's not in A.

class A {
    ...
    class B {
        ...
    }
    ...
}

class B {
    ...
}

How do I make an instance of outer B in A?

class A {
    B name = new B();
}

will get an instance of inner B.开发者_JAVA技巧


Specify the fully-qualified name of the external B. If B is in package com.acme, then say com.acme.B name = new com.acme.B();.

0

精彩评论

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