I have a class Fruits that consists of certain variables:
public class Fruits {
public static String abc="something";
}
public class Apple extends Fruits {
public static String abc="something";
}
Depending on the config it selects whether it should return an instance of Fruits or Apple:
Class Fruits{
public static Fruits getfruit{
if(config==3) {
return new Apple();
} else {
return new Fruits();
}
}
}
So later I can use Utility.getfruit().abc.
Map,List, ...)