jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes why this is not working(subclass to superclass). 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 » Java » Beginning Java
Bookmark "why this is not working(subclass to superclass)." Watch "why this is not working(subclass to superclass)." New topic
Author

why this is not working(subclass to superclass).

Ritesh raushan
Ranch Hand

Joined: Aug 29, 2012
Posts: 100
at compile time gives error.but i think that Object is a super class he takes all sub class object .

error-
method set in class Manager cannot be applied to given types;
m.set("ritesh");
^
required: Object
found: String
reason: actual argument String cannot be converted to Object by method invocation conve
rsion

Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4344
    
    8

The most likely explanation is you actually have your own Object class hanging around somewhere in the same package (either as source code or a compiled code). If you can't find it, try changing all the references to java.lang.Object and see if that changes the result.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why this is not working(subclass to superclass).
 
Similar Threads
Question on TreeSet
Polymorphism, arguments and instanceof questions
Derived Class & Method Calling
private constructor in abstract classes
Overriding static methods in subclass