Illegal modifier for the method name; only public, protected, private, abstract, static, final, synchronized, native & strictfp are permitted
Illegal modifier method name; allow only public, protected, private, abstract, static, final, synchronized, native and strictfp
A, public
The method of cross-package structure can call public class object
For cross-package calls, non-public modified method is not visible.
The method sex() from the type PublicUtilTest is not visible
Translation: PublicUtilTest type of process Sex () not visible
public method can be modified cross-package call.
二、protected
Non-public class can not be inherited in the other packages
PublicUtilA cannot be resolved to a type
Translation: PublicUtilA can not be resolved to a certain type
protected inheritance across package
The method PublicA.description() does not override the inherited method from PublicUtilTest since it is private to a different package
Translation: PublicA.description () method does not override inherited methods PublicUtilTest in, because it is private from different packages
Inherit inheritable permissions package and above method with a bag.
Three, private
Private methods modified if private, is not called, there will be a warning. Does not affect the use, but try to avoid never used methods and variables appear to reduce code redundancy.
The method speak() from the type PublicUtilTest is never used locally
译:PublicUtilTest类型的方法speak()从不在本地使用
private只能在本类其他方法中被调用,无法由对象实例直接调用。
通过Change visibility of 'speak()' to 'package'后会变成无修饰符方法 void speak(),可实现对象实例调用,但仅限于本包内,包权限的方法没有修饰符如PublicUtilA.description()。
四、