ClassA extends Object. Given the legal instantiations of:
InterfaceB myGuy = new ClassA();
and
ClassA myGuy = new ClassA();
What would the first line of the class declaration for ClassA likely be?
FYI, my last attempted answer was – “public class classA implements interfaceB {…}”
Yes, this is a homework question from a java noob. I would appreciate a good point in the right direction. Adolescent negative commentary can be kept to yourself…thank you.
You know that this line is legal:
In order for that assignment to be legal,
ClassAhas to extend or implementInterfaceB. You know thatClassAextendsObject, so it can’t extendInterfaceB. SoInterfaceBmust be an interface instead of a class.The first line of the interface declaration for
InterfaceBis:public interface InterfaceB {So what would the first line of the class declaration for
ClassAbe?