I want to have a method that will create an object of the class being and automatically name it "b1"
for the first object, "b2"
for the second, and so on. Can I use a String
as the name of a new object? If it's possible, how do I do it?
class being {
static int count = 0;
String name;
void createbeing(){
name = "b" + Integer.toString(count);
being name = new being(); //Here I want to insert the String name as the name of the object
count++;
}
}