aspose file tools*
The moose likes Beginning Java and the fly likes Error message:  not public in java. can't be accessed from outside package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Error message:  not public in java. can Watch "Error message:  not public in java. can New topic
Author

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

Maureen Charlton
Ranch Hand

Joined: Oct 04, 2004
Posts: 218
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?
Alain Boucher
Ranch Hand

Joined: Feb 25, 2003
Posts: 51
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


Alain Boucher<br />Spare-Brain Consultants Inc.<br />SCJ2P,SCWCD,
Maureen Charlton
Ranch Hand

Joined: Oct 04, 2004
Posts: 218
Alan - thanks for this. Much appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error message: not public in java. can't be accessed from outside package