Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following Java code: interface I { long f1(); long f2(); } abstract class C implements I { public long f1() { return 5;


 

Consider the following Java code:

interface I { long f1(); long f2(); }

abstract class C implements I { public long f1() { return 5; } } class C2 extends C {

public long f1() { return 99; }

public long f2() { return f1() + 33333333 *super.f1(); }

}

class C3 extends C2 { public long f1() { return 88888888; } }

//... in some other class, perhaps in a main() method ... final I x = new C3(); final I y = new C2();

a. What are the static (compile-time) and dynamic (runtime) types ofx?Static: Dynamic:

b. What are the static and dynamic types ofy?Static: Dynamic:

c. Why must class C be declaredabstract?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

a The static compiletime type of x is I as it is declared as an interface t... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Java Programs A Back To Basics Approach

Authors: Stuart Reges, Marty Stepp

5th Edition

013547194X, 978-0135471944

More Books

Students also viewed these Programming questions

Question

What was the positive value of Max Weber's model of "bureaucracy?"

Answered: 1 week ago

Question

Write a program called Egg that displays the following output:

Answered: 1 week ago

Question

List and explain the steps of process design. AppendixLO1

Answered: 1 week ago

Question

Illustrate the process design with a suitable example. AppendixLO1

Answered: 1 week ago

Question

Discuss the criteria for make or buy. AppendixLO1

Answered: 1 week ago