friendly? java有这个关键字吗?在java中默认是package. 别和c++搞混了,这个和c++的friendly是大有区别的。The Java Tutorial原文: In Java, you can use access specifiers to protect both a class's variables and its methods when you declare them. The Java language supports four distinct access levels for member variables and methods: private, protected, public, and, if left unspecified, package.
//不过纠正你的一个错误
//java中有protected没有friendly也给你纠正个错误,java里没有修饰符,就是默认为friendly
接口,类,枚举各个默认修饰符不一样
In Java, you can use access specifiers to protect both a class's variables and its methods when you declare them. The Java language supports four distinct access levels for member variables and methods: private, protected, public, and, if left unspecified, package.
------------更C++有什么区别呢?
这不是你我了解的范围了吧
就是说对包内的类其为protected,对包外的类其为private,
btw:在Java中,同包内的类可以访问protected权限的属性/方法