java文件中,有一个map,有固定值的,如下
         Map map = new HashMap();      
         map.put("249", "大头");
         map.put("250", "大头250");
         map.put("252", "大头3"); 
我在很多其它java文件,要用到这个map,
现问:1 如何把这个map放到一个java文件中
   2 在其它java文件中,如何取这个map
thanks

解决方案 »

  1.   

    public class Data {

    //网站根目录
    public static final String WEBROOT = "http://nc.8ff.cn/";

    public Map getMap(){
    Map map = new HashMap();      
            map.put("251", "早安南昌");
            map.put("632", "今日话题");
            map.put("640", "南昌印象");
            map.put("630", "便民服务");
            map.put("655", "八方杂谈");
            map.put("645", "精品贴图");
            return map;
    }


    //类中
    }