I have a issue with static variables in abstract classes because When i extend a class as a subclass it shares the same Variable value as all of the other ones And i wanted to know if there is a way to fix it without making each class seperate but still making the variables seperate.
My code Changes the variable When the subclass constructs But it it keeps the value of the last Subclass that is constructed which is the issue.
>Solution :
Static fields are always shared over all instances of a class, and subclasses, as they belong to the class.
If you want different class instances to have different values of their fields, you need instance variables.
protected, non static variables can be shared and accessed from subclasses