programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Tim Cooke
• Devaka Cooray
• Ron McLeod
• Jeanne Boyarsky
Sheriffs:
• Liutauras Vilda
• paul wheaton
• Junilu Lacar
Saloon Keepers:
• Tim Moores
• Stephan van Hulst
• Piet Souris
• Carey Brown
• Tim Holloway
Bartenders:
• Martijn Verburg
• Frits Walraven
• Himai Minh

# mock problem

Ranch Hand
Posts: 49
• Number of slices to send:
Optional 'thank-you' note:
10. abstract class A {
11. abstract void a1();
12. void a2() { }
13. }
14. class B extends A {
15. void a1() { }
16. void a2() { }
17. }
18. class C extends B { void c1() { } }
and:
A x = new B(); C y = new C(); A z = new C();
What are four valid examples of polymorphic method calls? (Choose four.)
options are

A. x.a2();
B. z.a2();
C. z.c1();
D. z.a1();
E. y.c1();
F. x.a1();

My ans is (A,B,E,F)
but correct ans is(A,B,D,F) how?
why e is not valid ans?

Ranch Hand
Posts: 113
• Number of slices to send:
Optional 'thank-you' note:
for Polymorphism
parent_class var = new child_class();
In c y = new c();
thereis no polymorphism

Ranch Hand
Posts: 99
• Number of slices to send:
Optional 'thank-you' note:
E is not correct because, y is an object of class C and c1() method is also of class C. So y is calling its own method which is a normal behavior and no polymorphism is involved...

 We're being followed by intergalactic spies! Quick! Take this tiny ad! the value of filler advertising in 2021 https://coderanch.com/t/730886/filler-advertising