Hi,
Can you plz tell why output is coming as Cat not Animal?
Also if I un-comment all lines, I get compile time error.
thanks
Abhi
***********************************
package Overload;
public class Animal {
// void child(Dog d) {System.out.println(" Dog");}
void child(Cat c){System.out.println(" Cat");}
void child(Animal a){System.out.println(" Animal");}
// void child(Mouse m){System.out.println(" Mouse");}
// private void child(Cat x){}
public static void main(String[] args) {
Animal an=new Animal();
an.child(null);
}
}
************
class Dog extends Animal{}
class Cat extends Animal{}
class Mouse extends Dog{}
--
You received this message because you are subscribed to the Google Groups
"JPassion.com: Java Programming" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jpassion_java?hl=en.