开发者

java programming [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicates:

Usage patterns for private, static, final, public, abstract keywords in java.

In Java, what's the difference between public, default, protected, and private?

what is the difference between the abstract, p开发者_运维百科ublic, private classes?


Public classes are accessible from all other classes, whereas private classes are only accessible from within the class itself. This is a good summary of the Java visibilities:

Modifier        Class     Package   Subclass  World
public          Y         Y         Y         Y
protected       Y         Y         Y         N
no modifier     Y         Y         N         N
private         Y         N         N         N

Abstract classes are a bit of a different beast. An abstract class is one that cannot be instantiated. In other words, you cannot invoke new on an abstract class; you would need to do so an a concrete sub-class.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜