I dont understand the concept

How are we able to do
P obj = new C();

How am i able to assign diff type of object to another type

Then why am i not able to do this
Integer k = new String(“abc”);

Please explain
And what is this concept called?

Also how is typecasting possible here?

And is there no video for polymorphism available?

Hey @bhavik911
just Tell me
Integer k = new String(“abc”); // ye aaps me kuch Inherite bhi kr raha h ?

I suggest you watch the video again.

Ohh okay
In case of inheritance only we can do this?
Also we can typecast if a class is inherited?

Question : we can typecast if a class is inherited?
Answer :
If a class is inherited, the object is typecast.