Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Find Maximum and Minimum in Array | Methods
Java Extended
course content

Contenido del Curso

Java Extended

Java Extended

1. Deep Java Structure
2. Methods
3. String Advanced
4. Classes
5. Classes Advanced

bookChallenge: Find Maximum and Minimum in Array

Tarea
test

Swipe to show code editor

Your task is to write two methods: one to find the maximum value and one to find the minimum value in the array.

  1. In the findMax method, initialize the max variable with the first element of the array.
  2. In the for loop, compare the current element with max.
  3. If the current element is greater, update max with the current element.
  4. Return the value of the max variable.
  5. In the findMin method, initialize the min variable with the first element of the array.
  6. In the for loop, compare the current element with min.
  7. If the current element is smaller, update min with the current element.
  8. Return the value of the min variable.
  9. In the main method, call the findMax method with the correct parameter, pass the numbers array into it, and assign the result to the max variable.
  10. In the main method, call the findMin method with the correct parameter, pass the numbers array into it, and assign the result to the min variable.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 8
toggle bottom row

bookChallenge: Find Maximum and Minimum in Array

Tarea
test

Swipe to show code editor

Your task is to write two methods: one to find the maximum value and one to find the minimum value in the array.

  1. In the findMax method, initialize the max variable with the first element of the array.
  2. In the for loop, compare the current element with max.
  3. If the current element is greater, update max with the current element.
  4. Return the value of the max variable.
  5. In the findMin method, initialize the min variable with the first element of the array.
  6. In the for loop, compare the current element with min.
  7. If the current element is smaller, update min with the current element.
  8. Return the value of the min variable.
  9. In the main method, call the findMax method with the correct parameter, pass the numbers array into it, and assign the result to the max variable.
  10. In the main method, call the findMin method with the correct parameter, pass the numbers array into it, and assign the result to the min variable.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 8
toggle bottom row

bookChallenge: Find Maximum and Minimum in Array

Tarea
test

Swipe to show code editor

Your task is to write two methods: one to find the maximum value and one to find the minimum value in the array.

  1. In the findMax method, initialize the max variable with the first element of the array.
  2. In the for loop, compare the current element with max.
  3. If the current element is greater, update max with the current element.
  4. Return the value of the max variable.
  5. In the findMin method, initialize the min variable with the first element of the array.
  6. In the for loop, compare the current element with min.
  7. If the current element is smaller, update min with the current element.
  8. Return the value of the min variable.
  9. In the main method, call the findMax method with the correct parameter, pass the numbers array into it, and assign the result to the max variable.
  10. In the main method, call the findMin method with the correct parameter, pass the numbers array into it, and assign the result to the min variable.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Tarea
test

Swipe to show code editor

Your task is to write two methods: one to find the maximum value and one to find the minimum value in the array.

  1. In the findMax method, initialize the max variable with the first element of the array.
  2. In the for loop, compare the current element with max.
  3. If the current element is greater, update max with the current element.
  4. Return the value of the max variable.
  5. In the findMin method, initialize the min variable with the first element of the array.
  6. In the for loop, compare the current element with min.
  7. If the current element is smaller, update min with the current element.
  8. Return the value of the min variable.
  9. In the main method, call the findMax method with the correct parameter, pass the numbers array into it, and assign the result to the max variable.
  10. In the main method, call the findMin method with the correct parameter, pass the numbers array into it, and assign the result to the min variable.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 2. Capítulo 8
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt