I would like to create 5-6 classes,I am storing values in hashmap in 1st class & I would like to call it from 4th,5th & 6th class.How to get this any snippets or example to implement this will be helpful,Thanks
public class Example {
private HashMap<String, String> hashmap = new HashMap<String, String>();
public HashMap<String, String> getHashmap() {
return hashmap;
}
public void setHashmap(HashMap<String, String> hashmap) {
this.hashmap = hashmap;
}
}
public class AnotherClass {
public static void main(String args[]) {
Example ex = new Example();
HashMap<String, String> hm = ex.getHashmap();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With