Can default visibility in Java Class have a protected member? -
in java, point of view, not create sense default-visible class have protected
member. point view, not create sense because default visibility in java = package-level protected visibility in java = package-level + subclass( regardless of package)
class testclass{ protected int addintegers(int a, int b){ homecoming (a+b); } // end of protected addintegers(int a, int b){ }
am right above code nonsense?
you have public class foo in same package, extending base of operations class, , class bar in package, extending foo , overriding protected method.
package a; class base of operations { protected void bang() { } } bundle a; public class foo extends base of operations { } bundle b; public class bar extends foo { @override protected void bang() { } }
java default semantics protected
No comments:
Post a Comment