Link to home
Start Free TrialLog in
Avatar of Brandon_Campbell
Brandon_CampbellFlag for United States of America

asked on

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

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.
Avatar of ksivananth
ksivananth
Flag of United States of America image

you need to get the reference of that class instance and then access the hashmap through that instance.
Avatar of Sathish David  Kumar N
Can you paste ur code ?
ASKER CERTIFIED SOLUTION
Avatar of Sharon Seth
Sharon Seth
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brandon_Campbell

ASKER

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,