0
private void buildingComposotion()
{
for (int i=1; i<=randomInteger(3,6); i++)
{
int numberOfStories = 2;
buildingFrame(numberOfStories);
buildingWindows(numberOfStories);
}
}
private int randomInteger(int min, int max)
{
min = (int) Math.ceil(min);
max = (int) Math.floor(max);
return Math.floor(Math.random() * (max - min));
}
錯誤,「不兼容的類型:可能有損從雙轉換爲整數。」在線15上。不兼容的類型:可能有損於從double到int的有損轉換。我不知道爲什麼我得到這個錯誤信息
沒有必要爲你調用'Math.ceil(分鐘)'或'Math.floor(最大值)'。這些值已經是整數。您還需要將'min'添加到返回的值。 – 4castle