wood burning stoves 2.0*
The moose likes Java in General and the fly likes Collections Frame work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Collections Frame work" Watch "Collections Frame work" New topic
Author

Collections Frame work

Laxmi Bhavisetti
Greenhorn

Joined: Oct 11, 2011
Posts: 16


In the above program, when im trying to compile. The error im facing is Cannot find symbol ( Set<Map.Entry<String, Double>> set = hm.entrySet();
// Display the set
for(Map.Entry<String, Double> me : set):
Symbol is: class Entry
Location: class Map.

Can some one help me in this error.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37970
    
  22
Compiled and ran first time when I tried it.
What version of javac are you using?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Do you maybe have a class that you wrote yourself that is called Entry or Map? It could be that the Java compiler is picking that up instead of the class Entry or Map from the package java.util.

Make sure that you remove any class named Entry or Map that you might have in your project.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Laxmi Bhavisetti
Greenhorn

Joined: Oct 11, 2011
Posts: 16
Hi Jesper,

Well i even tried to copy the program file on desktop and compile it. Its still showing the same error. Well Im working on different programs not on project. Learning java from complete reference to java book. As far i searched for class on those names, there are no programs specified with that name.

Hi campbell
The version of java im using is latest JRE 7
Laxmi Bhavisetti
Greenhorn

Joined: Oct 11, 2011
Posts: 16
Thank you jesper,
ive Got it. I took all my applications to other file and tried to execute this. IT worked thank you
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37970
    
  22
You must have another class called Map.Entry or similar somewhere in your folder.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Only another class named Map. The error says it can find Map, but there's no nested class Entry inside Map.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37970
    
  22
Yes, you read the error message better than me.
 
wood burning stoves
 
subject: Collections Frame work
 
Similar Threads
Adding and sorting Hashmaps.
Please explan how set.iterator() gets called when set is of type interface?
HASHMAP
HashMap Doubt
HashMap Query