Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Names Starting with Letter B | Methods
Java Extended
course content

Conteúdo do Curso

Java Extended

Java Extended

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

bookChallenge: Names Starting with Letter B

Tarefa

Your task is to write a sortNamesStartWithLetterB method that will return only the names from this array names that starts with the letter B.

  1. Loop through the array and count how many names start with the letter B.
  2. Use the charAt() method to extract the first letter of each name and compare it to the letter B.
  3. Make sure you are checking for the uppercase letter 'B'.
  4. After counting, set the size for the new result array.
  5. Initialize the index variable, which will be used as the index for the result array.
  6. Loop through the array again and add names starting with B to the new array.
  7. Increment the index each time you add an element to the new array.
  8. Return the new array with the names.
  9. In the main method, call the sortNamesStartWithLetterB method.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 3
toggle bottom row

bookChallenge: Names Starting with Letter B

Tarefa

Your task is to write a sortNamesStartWithLetterB method that will return only the names from this array names that starts with the letter B.

  1. Loop through the array and count how many names start with the letter B.
  2. Use the charAt() method to extract the first letter of each name and compare it to the letter B.
  3. Make sure you are checking for the uppercase letter 'B'.
  4. After counting, set the size for the new result array.
  5. Initialize the index variable, which will be used as the index for the result array.
  6. Loop through the array again and add names starting with B to the new array.
  7. Increment the index each time you add an element to the new array.
  8. Return the new array with the names.
  9. In the main method, call the sortNamesStartWithLetterB method.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 3
toggle bottom row

bookChallenge: Names Starting with Letter B

Tarefa

Your task is to write a sortNamesStartWithLetterB method that will return only the names from this array names that starts with the letter B.

  1. Loop through the array and count how many names start with the letter B.
  2. Use the charAt() method to extract the first letter of each name and compare it to the letter B.
  3. Make sure you are checking for the uppercase letter 'B'.
  4. After counting, set the size for the new result array.
  5. Initialize the index variable, which will be used as the index for the result array.
  6. Loop through the array again and add names starting with B to the new array.
  7. Increment the index each time you add an element to the new array.
  8. Return the new array with the names.
  9. In the main method, call the sortNamesStartWithLetterB method.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Tarefa

Your task is to write a sortNamesStartWithLetterB method that will return only the names from this array names that starts with the letter B.

  1. Loop through the array and count how many names start with the letter B.
  2. Use the charAt() method to extract the first letter of each name and compare it to the letter B.
  3. Make sure you are checking for the uppercase letter 'B'.
  4. After counting, set the size for the new result array.
  5. Initialize the index variable, which will be used as the index for the result array.
  6. Loop through the array again and add names starting with B to the new array.
  7. Increment the index each time you add an element to the new array.
  8. Return the new array with the names.
  9. In the main method, call the sortNamesStartWithLetterB method.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 2. Capítulo 3
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
some-alt