所以我有两个java文件,第一个是“ group people”,第二个是“ table people”。通过调用表人员将人员分组的操作会将两个详细信息(名称和年龄)保存在维数组中,并且每次调用表时都将其添加。然后,我将实现另一个将重置表的类。我想补充一点,我是维度数组的新手。我在理解如何实现构造函数时遇到问题,该构造函数在被小组调用时会将它们添加到维数组中。
请对我好一点,我是新手:)这只是我正在尝试学习Java的一个小项目
public class peopleGroup {
private static final person1 = ("Jon", 15);
private static final person2 = ("Bob", 20);
private static final person3 = ("Dan", 100);
private static tablePeople addPeople() {
tablePeople k = makeEmptyTable();
k.add(person1);
return k;
}
public static void main(String[] args) {
tablePeople Table;
testTable("toString", Table.toString());
}
不同的文件
public class tablePeople {
private String name;
private int age;
private Object [][] peopleTable; //not sure about object
/* Constructor */
public /* not sure*/ add(Item[] items) {
here I will like to add the name and age inside the dimensional array
}