No, this is not possible in Java; you cannot create variables at runtime. You could, however, maintain a Map
that maps String
identifiers to their corresponding Being
s. i.e.
Map<String, Being> map = new HashMap<String, Being>();
...
name = "b" + Integer.toString(count);
map.put(name, new Being());
count++;
Note that I have assumed a more conventional name: Being
as opposed to being
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…