Contenido del Curso
Java Extended
Java Extended
Challenge: Names Starting with Letter B
Tarea
Swipe to show code editor
Your task is to write a sortNamesStartWithLetterB
method that will return only the names from this array names
that starts with the letter B
.
- Loop through the array and count how many names start with the letter
B
. - Use the
charAt()
method to extract the first letter of each name and compare it to the letterB
. - Make sure you are checking for the uppercase letter 'B'.
- After counting, set the size for the new result array.
- Initialize the index variable, which will be used as the index for the result array.
- Loop through the array again and add names starting with
B
to the new array. - Increment the index each time you add an element to the new array.
- Return the new array with the names.
- In the main method, call the
sortNamesStartWithLetterB
method.
Solución
solution
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 3
Challenge: Names Starting with Letter B
Tarea
Swipe to show code editor
Your task is to write a sortNamesStartWithLetterB
method that will return only the names from this array names
that starts with the letter B
.
- Loop through the array and count how many names start with the letter
B
. - Use the
charAt()
method to extract the first letter of each name and compare it to the letterB
. - Make sure you are checking for the uppercase letter 'B'.
- After counting, set the size for the new result array.
- Initialize the index variable, which will be used as the index for the result array.
- Loop through the array again and add names starting with
B
to the new array. - Increment the index each time you add an element to the new array.
- Return the new array with the names.
- In the main method, call the
sortNamesStartWithLetterB
method.
Solución
solution
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 3
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones