따라서 기본 메서드에 크기 8의 배열을 입력하고이 메서드를 호출하여 가장 높은 값 점수를 반환했지만 0.0 만 반환합니다.
public static double Larger(double[] scoresRecived)
{
scoresRecived = new double[8];
int c;
double largestScore = 0;
for (c = 0; c < 8; c++)
{
if (scoresRecived[c] > largestScore)
largestScore = scoresRecived[c];
}
return largestScore;
}
scoresRecived
매개 변수를 로컬로 덮어 씁니다 . scoresRecived = new double[8];
선을 제거하십시오 .
그리고 아마도 largestScore
.
public static double Larger(double[] scoresRecived)
{
int c;
double largestScore = 0.0;
if (scoresRecived != null) {
for (c = 0; c < scoredRecived.length; c++)
{
if (scoresRecived[c] > largestScore)
largestScore = scoresRecived[c];
}
}
return largestScore;
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다