This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Method Overriding with Object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Method Overriding with Object" Watch "Method Overriding with Object" New topic
Author

Method Overriding with Object

Srinivas Palam
Ranch Hand

Joined: Oct 20, 2005
Posts: 43
According to the scjp6 book, red colored line should disply Animal, but I am geeting complie error. Please help.




ERROR:
D:\Java>javac UseAnimals.java
UseAnimals.java:19: useAnimals(Horse) in UseAnimals cannot be applied to (Animal
)
ua.useAnimals(animalRefToHorse);
^
1 error

D:\Java>
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I expect that's because you misspelled the method name in line 6 of your posted code.
Srinivas Palam
Ranch Hand

Joined: Oct 20, 2005
Posts: 43
Thank You.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Method Overriding with Object
 
Similar Threads
Compile time polymorphism
knb book pgs 308-310 polymorphism con't.
needs explanation
Query on the topic overloading
Dout about overloaded methods