是否可以创建此子模块?当所有代码都在 main 中时,代码可以正常工作,而不是作为子模块。
{
public static void main (String [] arsg)
{
int number, inWeight, weight;
boolean veriWeight;
weight=inWeight();
System.out.println("Average month weight is "+(weight/12));
System.exit(0);
}
private static int inWeight ();
{
for (int i=1; i<=12; i++)
{
number=ConsoleInput.readInt("enter month weight");
while (number<=0)
{
System.out.println("error, try again");
number=ConsoleInput.readInt("enter month weight");
}
inWeight += number;
}
return number;
}
}