minimum value in java won't work

后端 未结 4 1693
予麋鹿
予麋鹿 2021-01-24 13:02

I need help because my brain cells cannot find what is wrong with this program! Here\'s the code

     import java.util.*;
      public class student{
      publ         


        
4条回答
  •  被撕碎了的回忆
    2021-01-24 13:55

    int minValue=myArray[0]; 
    

    because of this line, your minValue is set to 0. So the minimum value would be reset in this method only if the myArray[i] in the below code is less than 0. Otherwise it remains 0.

     for( i=1; i

提交回复
热议问题