Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Collections Frame work

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
 
Marshal
Posts: 79528
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Compiled and ran first time when I tried it.
What version of javac are you using?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Laxmi Bhavisetti
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Marshal
Posts: 79528
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You must have another class called Map.Entry or similar somewhere in your folder.
 
Sheriff
Posts: 22791
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Only another class named Map. The error says it can find Map, but there's no nested class Entry inside Map.
 
Campbell Ritchie
Marshal
Posts: 79528
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you read the error message better than me.
 
Arthur, where are your pants? Check under this tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic