I have intialized Hash map inside static block, I need to access the hashmap object to get the value using key it inside my getExpo method.
My class goes here
public class ExampleFactory {
static
{
HashMap<
String,Class<?>> hmap = new HashMap<String,Class<?>>();
hmap.put("app", application.class);
hmap.put("expo", expession.class);
}
public void getExpo(String key,String expression)
{
// I need to access the object in static block
Class aclass=(Class) hmap.get(key); // it works when i place the hashmap intialization inside main method but not working when i place Hashmap initialiastion in static block
return null;
}