What is the output of running class C?
class A {
public A() {
System.out.println(
"The default constructor of A is invoked");
}
}
class B extends A {
public B() {
System.out.println(
"The default constructor of B is invoked");
}
}
public class C {
public static void main(String[] args) {
B b = new B();
}
}
a. none
b. "The default constructor of B is invoked"
c. "The default constructor of A is invoked" followed by "The default constructor of B is invoked"
d. "The default constructor of A is invoked"
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q15: Analyze the following code: public class Test
Q16: Suppose the xMethod() is invoked from a
Q17: Write a program that converts US dollars
Q18: Design and implement classes.
Design a class
Q19: What modifier should you use on a
Q20: Which code fragment would correctly identify the
Q21: Analyze the following program. class Test {
Public
Q22: To append data to an existing file,
Q23: What is displayed on the console when
Q24: After the following program is finished, how
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents