Contenido del Curso
Java Extended
Java Extended
Sorting Even Numbers Challenge
Tarea
Your task is to write a method to sort an integer array in such a way that it contains only even values (even numbers are those that are divisible by 2 without a remainder). After that, in the main
method, you need to print them to the console.
I've already written a method for displaying the array on the screen, so don't worry about it.
This task is a great opportunity to learn a new operator. The %
operator returns the remainder of a division operation. For example, 5 % 2 = 1
. This is because 5
does not divide evenly by 2
, so when we divide 5
by 2
, we have a remainder of 1
. You can use this operator in the task to check if a number is even. Use the if syntax: if (element % 2 == 0)
- this expression will check if the number is even and return true
or false
.
¡Gracias por tus comentarios!
Sorting Even Numbers Challenge
Tarea
Your task is to write a method to sort an integer array in such a way that it contains only even values (even numbers are those that are divisible by 2 without a remainder). After that, in the main
method, you need to print them to the console.
I've already written a method for displaying the array on the screen, so don't worry about it.
This task is a great opportunity to learn a new operator. The %
operator returns the remainder of a division operation. For example, 5 % 2 = 1
. This is because 5
does not divide evenly by 2
, so when we divide 5
by 2
, we have a remainder of 1
. You can use this operator in the task to check if a number is even. Use the if syntax: if (element % 2 == 0)
- this expression will check if the number is even and return true
or false
.
¡Gracias por tus comentarios!
Sorting Even Numbers Challenge
Tarea
Your task is to write a method to sort an integer array in such a way that it contains only even values (even numbers are those that are divisible by 2 without a remainder). After that, in the main
method, you need to print them to the console.
I've already written a method for displaying the array on the screen, so don't worry about it.
This task is a great opportunity to learn a new operator. The %
operator returns the remainder of a division operation. For example, 5 % 2 = 1
. This is because 5
does not divide evenly by 2
, so when we divide 5
by 2
, we have a remainder of 1
. You can use this operator in the task to check if a number is even. Use the if syntax: if (element % 2 == 0)
- this expression will check if the number is even and return true
or false
.
¡Gracias por tus comentarios!
Tarea
Your task is to write a method to sort an integer array in such a way that it contains only even values (even numbers are those that are divisible by 2 without a remainder). After that, in the main
method, you need to print them to the console.
I've already written a method for displaying the array on the screen, so don't worry about it.
This task is a great opportunity to learn a new operator. The %
operator returns the remainder of a division operation. For example, 5 % 2 = 1
. This is because 5
does not divide evenly by 2
, so when we divide 5
by 2
, we have a remainder of 1
. You can use this operator in the task to check if a number is even. Use the if syntax: if (element % 2 == 0)
- this expression will check if the number is even and return true
or false
.