Consider the classes shown below: public class Parent
{
Public void doSomething() // method 1
{ /* Implementation not shown */ }
}
Public class Child extends Parent {
Public void doSomething(int n) // method 2
{ /* Implementation not shown */ }
Public void doSomething() // method 3
{ /* Implementation not shown */ }
}
If the variable kid is defined below, which version of the doSomething method can be called on the variable kid?
Parent kid = new Child() ;
A) Method 1 only
B) Methods 2 and 3 only
C) Methods 1 and 2 only
D) Methods 1, 2, and 3
Correct Answer:
Verified
Q47: Consider the following code snippet: public class
Q48: Consider the classes shown below: public class
Q49: Consider the following code snippet: public class
Q50: If a subclass contains a method with
Q53: Consider the following code snippet: public class
Q54: Consider the following code snippet: public class
Q54: Consider the following code snippet: public class
Q55: Consider the following code snippet: public class
Q56: To override a superclass method in a
Q57: Consider the following code snippet that appears
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