Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Help with JAVA problem Take a look a this code with two classes C and D and inte

ID: 3671836 • Letter: H

Question

Help with JAVA problem

Take a look a this code with two classes C and D and interface I:

Answer these question:

Where is the error in this code sequence:

1. C c1 = new C();

2. D d1 = new D();

Is there an error in this code? Why?

C c2;

c2 = new D();

Where is the error in this new class?

public class E extends D

{

public void foo4()

{

public void foo4()

{ super.foo4();

System.out.println ("Hello E foo()");

} }

Where is the error in this class?

public class J extends I {}

Where is the error in this class?

public class K

{ public void foo(); }

Dublic abstract classC pu private void fool() System.out.printin( "Hello foo1" ): public abstract void foo2(); public abstract int foo3(); public class D extends C public void foo2() System.out.println( "Hello foo2()"); public int foo3( ) return 10; private void foo4() System.out.printIn( "Hell0 D foo4(); public interface I public static final double PI = 3.14;

Explanation / Answer

1. The Error says that

C is abstract it cannot be instantiated

2. The class D is public which should be declared in separate file

3. There is no error

4. Class D already contains foo4() which should be overridden

5. I is interface it must be implemented not extended

6. missing method foo();

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote