• 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

Error message: not public in java. can't be accessed from outside package

 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MainProgram.java:120: java.util.HashMap.Entry is not public in java.
; cannot be accessed from outside package
HashMap.Entry entry = (HashMap.Entry)iterator2.next( );

Is anyone able to explain to me what this is actually saying?
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hashmap.class:

public class HashMap extends AbstractMap implements Map, Cloneable,
java.io.Serializable {
/**
* The hash table data.
*/
private transient Entry table[];

etc...

Entry is private... you cannot use Hashmap.Entry because you are not in a method in the Hashmap class, this field is private to that class

The Entry class is a Inner class of HashMap, so it is for internal use only (because of private)

Only use public method to get your data
 
Maureen Charlton
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alan - thanks for this. Much appreciated.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic