0

We can use the enum instead of int,char,float this type of declaration please help mee

Your program prints New A New B Why? Because in main function you are declaring object of class B which is child class of class A Complier see that you create object of class b but class b is extended to class A instead of going inside of class B it goes to it's parent class because it see class B extends class A {} Then it's prints new A from class A And then prints new B from class B after compiling class A .

16th Oct 2019, 3:18 PM
Pravallika
2 Respuestas
+ 3
Can you post the code as well?
16th Oct 2019, 3:20 PM
Abhishek Tandon
Abhishek Tandon - avatar
+ 2
Please specify the language in Relevant Tags. 'mounika' doesn't help in deducting the scope of your question 👍
16th Oct 2019, 5:16 PM
Ipang