What is the proper way to modify a field of outer class? When trying to change from inner static class the value
of Artifact
it gives an error. There is need to iterate over array list which contains objects of type Artifact
; and be able to display for each Artifact
(whether it is Coin or Goblet) the value.
public class Artifact {
public int value = 0;
public static class Goblet extends Artifact{
value = 5; // Syntax error on token "value", VariableDeclaratorId expected after this token
}
public static class Coin extends Artifact{
value = 10;
}
}