开发者

Java multiple class definitions in the same file

just a simple question, if you have the following code in a file called Example.java:

package MyPackage;

public class Example{
   void foo(){}
   ...
   ...
}

class A{}
class B{}

what is the modifier of the cl开发者_运维百科ass A and B?


They have the default modifier, which means package-private. See here


They are both default visibility (package private).

  • Controlling Access to Members of a Class (Java Tutorial)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜