KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am an AP Java Student and I am practicing for my exam. I came across this question and I don't understand the answer: Consider the following classes: public class A { public A() { methodOne(); } public void methodOne() { System.out.print("A"); } } public class B extends A { public B() { System.out.print("*"); } public void methodOne() { System.out.print("B"); } } What is the output when the following code is executed: A obj = new B(); The correct answer is B*. Can someone please explain to me the sequence of method calls?
Tags (comma-separated)
Save Edits
Cancel