Answer to Question #203545 in Java | JSP | JSF for Muqeet Waraich

Question #203545

Can we not use an object of the Parent Class in the Child Class and use all its features?


1
Expert's answer
2021-06-05T23:51:35-0400
public class Parent {

    int name;
}
public class Child extends Parent{

    int salary;
}
public class Main {

    public static void main(String[] args)
    {
        Parent parent = new Child();
        parent.name= "abcd";
    }
}
//This Example show how that case posible.This call dinamic polymorphism.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS