开发者

What is in Java the 'system default package'?

While researching the URLConnection c开发者_运维技巧lass I stumbled on a reference to system default package in the API docs for the URL class here.

Anyone knows what that is?

Thanks.


I believe it means a system-dependent package name that is used as a fallback when the first two steps fail to find an appropriate URLStreamHandler. It is unrelated to the default package.


The default package is basically no package at all. If you were to ommit the package declaration when defining a new class. The difference seems to be the word "system." Looking through the implementation of URL.class in rt.jars it seems to check sun.net.www.protocol I would guess that is the system default package it is referring to.

Again the name 'system' default package seems to imply a difference between default package.

Keep in mind sun.net.www.protocol is only valid for a specific implementation of the JVM by Sun.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜