dpalyca755
asked on
static maps
How do I implement a static map class to be used by a few other classes?
examples to follow will be great.
examples to follow will be great.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
HashMap as any Java object can be made static and then you could address it by refereinng to the class name rather than the instance of the class where it is a field
So if you declare it like that:
class ClassName {
public static HashMap<Integer, String> map;
...
}
Thane in any other class of your applucation you can address it like that:
ClassName.map.get(key)
thsi is no different form any other static object