So I have object
@Data
public class Bicycle{
private String color;
private long speed;
private String tag;
public Bicycle(String color, long speed){
color = color;
speed = speed;
}
public void setTag(String tag){
tag = tag;
}
}
I also have a Helper class that contains all my constants where I store a Bicycle I want to reference alot. I want to add a Bicylce with color="blue",speed=5L,tag="mountain" as a public static variable but I'm not sure how to do that since the constructor doesnt use tag, and setTag returns void. I don't own this Bicycle class so I can't add it to the constructor.
public class Helper{
public static final Bicycle = new Bicycle("blue",5L);
}
Because of this, whenever I have to create this bicycle
main{
Bicycle bicycle = Helper.Bicycle;
Bicycle.setTag"mountain");
}
How would I create this bicycle with the "mountain" tag in the Helper class?