
Solve a problem – Filter by language, license, keyword, owner, or search text to find code & info fast.
Join Siafoo Now
or
Learn More
Declaring and initializing a static hashmap
0
In Brief | A simple example of how to initialize a static hash map in java |
Language | Java |
# 's
1public class ExampleClass {
2 public final static HashMap consts = new HashMap();
3 static
4 {
5 constants.put("A", "The Letter A");
6 constants.put("B", "The Letter B");
7 constants.put("C", "The Letter C");
8 }
9 /* Rest of your class that needs to know the consts */
10}
A simple example of how to initialize a static hash map in java
Add a Comment