我想知道每次运行方法时如何命名不同的新对象
public class Horse extends Animal{
int horsenum = 0;
}
public void reproduce(Horse h){
horsenum ++;
Horse newHorse = new Horse(); //Here is where I would like to name the new horse "newHorse1, newHorse2, etc."
答案 0 :(得分:0)
添加Horse.Name ofType字符串的属性,并将其命名为...