wood burning stoves 2.0*
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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: 14117
    
  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
 
 
subject: Incompatible types error