0
Can we pass class or class reference variable in method as parameter.
class Animal { } class Monkey extends Animal { } class Test { public void m1(Animal a) { system.out.println("Animal version") } } public static void main(String[] args) { Test t = new Test(); Animal a=new Animal(); t.m1(a); } what will be the output of above code please elaborate .
7 Antworten
+ 2
When ran this code in on Code Playground what were the results.
Let this be your first code.
+ 1
Anurag Rastogi
Did the results answer your question?
+ 1
Are you saying your code didn't work, or you don't understand the results?
+ 1
Either make your code public or post it in this thread.
0
Animal version is the output
0
nopes ...I didnt get it
0
m talking about the results ..there are more functions calls in main funtion which I hvnt mentioned ..I have posted full code on my profile