How to get values from a different class in a separate package

Brandon_Campbell
Brandon_Campbell used Ask the Experts™
on
I have a program with several packages in the source folder. All packages have public classes with public getters and setters.

I have a class that needs to get a HashMap from another class in a different package that has already been instantiated. I went the route of importing the class but I cannot get access to the values. I did look at reflection but this did not pan out for me. Am I missing something obvious? At a loss for the moment.

Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
you need to get the reference of that class instance and then access the hashmap through that instance.
Can you paste ur code ?
When you say that you don't get access to the values , do you mean that you are able to access the hashmap , but not the values ? Something like the hashmap is empty?
Is it a static hashmap BTW ?
Brandon_CampbellSenior Systems Analyst

Author

Commented:
While the variable was static the getter was only public. When I set the getter to public static HashMap then everything worked great.

Thank you,

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial