Question
In Java, a class can: a. Extend only one class, and implement multiple interfaces. b. Extend more than one class and implement multiple interfaces. c.
In Java, a class can:
a. Extend only one class, and implement multiple interfaces.
b. Extend more than one class and implement multiple interfaces.
c. Extend only one class and implement only one interface.
d. None of the above.
Class A compiles, and has a single constructor that takes a string as parameter.
Class B extends class A. If "super()" is the first statement in the constructor
of class B, then:
a. B's constructor will compile.
b. We need to define a default constructor in class A in order for B's constructor
to compile.
c. We need to remove the "super()" from the class B's constructor for it to compile.
d. None of the above.
The Programmer class defines a method named "implement" that has the following
prototype:
protected String implement(int linesOfCode);
The JavaProgrammer class extends the Programmer class. Which of the following
is the prototype of a method in the JavaProgrammer class that OVERRIDES
the "implement" method of the Programmer class?
a. public String implement(int linesOfCode);
b. private String implement(int linesOfCode);
c. public String implement();
d. a. and b.
e. a. and c.
This question relies on the same information as the previous one. The
Programmer class defines a method named "implement" that has the following
prototype:
protected String implement(int linesOfCode);
The JavaProgrammer class extends the Programmer class. Which of the following
is the prototype of a method in the JavaProgrammer class that OVERLOADS (not
OVERRIDES as in the previous question) the "implement" method of the Programmer
class?
a. public String implement(int linesOfCode);
b. private String implement(int linesOfCode);
c. public String implement();
d. a. and b.
e. a. and c.
We can tell whether two objects belong EXACTLY to the same class by using:
a. The instanceof operator.
b. The getClass() method.
c. a. or b.
d. None of the above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started