【发布时间】:2015-04-30 05:37:44
【问题描述】:
我有一个公共方法,我想将双变量传递给我的 main 方法,我再次调用它们:
(在实际代码中,公共方法被多次调用,需要返回给调用者相同的值)
public double ReturnDoubleVariables()
{
double ret1 promptUserForInput("1st Varaible", );
double ret2 promptUserForInput("2nd Varaible", );
double ret3 promptUserForInput("3rd Varaible", );
double ret4 promptUserForInput("4th Varaible", );
double ret5 promptUserForInput("5th Varaible", )
return (ret1, ret2,...,ret5);
}
private void execute0() {
Simulation simulation_0 = getActiveSimulation();
scalarProfile_0.getMethod(ConstantScalarProfileMethod.class).getQuantity().setValue(ret1);
scalarProfile_0.getMethod(ConstantScalarProfileMethod.class).getQuantity().setValue(ret2);
scalarProfile_0.getMethod(ConstantScalarProfileMethod.class).getQuantity().setValue(ret3);
scalarProfile_0.getMethod(ConstantScalarProfileMethod.class).getQuantity().setValue(ret4);
scalarProfile_0.getMethod(ConstantScalarProfileMethod.class).getQuantity().setValue(ret5);
}
我在从公共方法返回多个变量时遇到问题,然后我不知道应该如何调用主方法中的变量?
提前致谢
【问题讨论】:
标签: java variables object methods