Important Notice:

Practice-It will be discontinued as of November 1st, 2024. After this date, the website will remain online for a transitional period, but login will be restricted to University of Washington NetID authentication. This marks the next phase towards the platform's full retirement. Thank you for your use and support of the application over the years.

If you are looking for an alternative, a similar tool, CodeStepByStep, was developed independently by the original author of Practice-It, and is available at codestepbystep.com**

logo Practice-It logo

EddieKurtChrisJerry

Author: Marty Stepp (on 2012/03/21)

Consider the following classes:

public class Eddie extends Kurt {
    public void b() {
        a();
        System.out.println("Eddie 2");
    }

    public void c() {
        System.out.println("Eddie 3");
    }
}

public class Kurt {
    public void a() {
        System.out.println("Kurt 1");
        c();
    }

    public void c() {
        System.out.println("Kurt 3");
    }
}

public class Chris extends Jerry {
    public void b() {
        System.out.println("Chris 2");
        super.c();
    }

    public void c() {
        System.out.println("Chris 3");
    }
}

public class Jerry extends Kurt {
    public void c() {
        System.out.println("Jerry 3");
        super.c();
    }
}

Suppose the following variables are defined:

Kurt   var1 = new Jerry();
Chris  var2 = new Chris();
Kurt   var3 = new Eddie();
Kurt   var4 = new Chris();
Object var5 = new Jerry();

Indicate on each line below the output produced by each statement shown. If the statement produces more than one line of output indicate the line breaks with slashes as in a/b/c to indicate three lines of output with a followed by b followed by c. If the statement causes an error, write the word error to indicate this.

var1.a();
var1.c();
var2.a();
var2.b();
var3.a();
var3.b();
var4.a();
var5.a();
((Chris) var5).a();
((Jerry) var1).a();
((Jerry) var4).a();
((Chris) var3).b();
((Eddie) var3).b();
((Jerry) var4).c();
((Kurt) var5).c();

You must log in before you can solve this problem.


Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.