Accessing a HashMap from a different class

前端 未结 6 1560
暗喜
暗喜 2020-12-30 08:02

I have a hashmap in my class titled DataStorage:

HashMap people = new HashMap();

people.put(\"bob\", 2);
peopl         


        
6条回答
  •  悲&欢浪女
    2020-12-30 08:29

    You can access it:

    DataStorage storage = new DataStorage();
    HashMap people = storage.people;
    

提交回复
热议问题