Animal is the parent class of Cat class.
public static void main (String[] args)
{
Animal myCat1 = new Cat; //Allocation 1
Cat myCat2 = new Cat; //Allocation 2
}
What is the diffrerence of two allocation??Each is true ,isn’t it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Neither of these are valid. You need
(). Apart from that:You can refer to any object by any of its superclasses, up to
Object. This is polymorphism.