Scope Experiments package p1; class c1 { private static int x; protected static void setx(int x) { c1.x = x; } } package p1; class c2 { protected c2() { c1.setx(10); } } //Is it possible to create another protected or public method called setx in c1 or c2? overloading or overriding (requires c1 or c2 to be a child). //why should constructors be declared public for classes in a package. package p2; import p1.*; class c3 extends c2 { private c2 blah; c3() { blah = new c2(); } } |
Announcements >