
class Parent has a public method play() that prints "Parent is playing". A class Child that extends the Parent class also has the method play() that prints "Child is playing". An instance of Child class called Sonu is typecast to Parent class as below. Child sonu = new Child(); Parent p = (Parent) sonu; p.play(); What will be the output of above section of code?

Output is: Child is playing

Write a Program that accepts a String by your name and display it on the screen
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.