【发布时间】:2019-08-03 17:56:59
【问题描述】:
如果我有一个数组,我可以使用其中的值来命名变量吗?
到目前为止,我已经尝试过......
String Statement = "Please enter the ";
String[] Variables = {"Weight", "Length", "Height", "Width",
"Zones"};
for (int x = 0; x <= 3; x++) {
double Array.get(Variables, x) = UI.askDouble(Statement + Variables[x] + " (kg): ");
}
没有运气。
【问题讨论】:
-
我认为可以将变量命名为与数组中的值相同的名称。