aspose file tools*
The moose likes Beginning Java and the fly likes Incompatible types error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Incompatible types error" Watch "Incompatible types error" New topic
Author

Incompatible types error

Thomas Kennedy
Ranch Hand

Joined: Jan 20, 2008
Posts: 137
This



produces

getp.java:10: incompatible types
found : java.util.Enumeration<capture of ?>
required: java.util.Enumeration<java.lang.String>
Enumeration<String> e = p.propertyNames();

while this



compiles ok.

What is the problem?


Costs matter. Justice lies in processes not outcomes. Crime is caused by criminals.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14428
    
  23

Class Properties was from before the time that generics were added to Java. So the method propertyNames() returns a raw Enumeration, and not an Enumeration<String>.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Incompatible types error