File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes what's the error? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "what Watch "what New topic
Author

what's the error?

Nabila Mohammad
Ranch Hand

Joined: Nov 05, 2007
Posts: 661
I am getting error with this simple problem which is supposed to compile with out any problem.

I get:
incompatible types
found:TreeSet
required java.util.Set
Set s=new TreeSet();
^



The future belongs to those who believe in the beauty of their dreams.Dream BIG!
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18765
    
  40

Basically, you named your class TreeSet. So, when you instantiated a TreeSet, it will instantiate your class, and not the TreeSet in the collection classes.

And since your TreeSet doesn't implement the Set interface, you are getting the error.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Nabila Mohammad
Ranch Hand

Joined: Nov 05, 2007
Posts: 661
Thanks alot!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what's the error?