File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Android Security Essentials Live Lessons this week in the Android 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: 14074
    
  16

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 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Incompatible types error
 
Similar Threads
whats wrong with this code?
java.util
System properties
Tomcat 4.0.4
accessing JDK information from .jsp page