我正在尝试使用相关信息打印出姓名。我想要他们的年龄,薪水,保险等。我正在尝试使用for循环来实现这一目标,但我显然错过了一些东西。我也不希望它总结年龄,我个人想要它。我找不到打印所有信息的方法。
public static double printArray(int[] noclue, String[] name, double[] age, double[] salary, double[] insurance, double[] expense, double[] savings)
{
int total = 0;
String names = "";
for (int i = 0; i < noclue.length; i++)
{
total = total + noclue[i]
names = name[i];
}
return total;
return names;
}
}
主要:
System.out.println(array.printArray(noclue, name, age, salary,insurance, expenses, savings));
答案 0 :(得分:-1)
这个怎么样:
public static void printArray(int[] noclue, String[] name, double[] age, double[] salary, double[] insurance,
double[] expense, double[] savings) {
for (int i = 0; i < noclue.length; i++) {
System.out.println(noclue[i] + " " + name[i] + " " + age[i] + " " + salary[i] + " " + insurance[i]);
}
}