In Java a reference variable of superclass is assigned to sub class . ls superclass knows the variables and methods of subclass | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

In Java a reference variable of superclass is assigned to sub class . ls superclass knows the variables and methods of subclass

Java

11th Apr 2019, 2:06 PM
Pravallika
2 Respostas
+ 1
It depends on type of object not the type of reference
13th Apr 2019, 3:35 PM
Pravallika
0
I think inheritance works only downstream. Anyway the child class methods and variables will be visible for the parent class if they are public.
11th Apr 2019, 5:37 PM
Nonea
Nonea - avatar