Announcements‎ > ‎

Questions on Scope Management discussed in class.

posted Feb 8, 2012, 8:02 PM by Sukhjit Singh
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() {

//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;
        blah = new c2();

Sukhjit Singh,
Feb 8, 2012, 8:02 PM