Зміст курсу
Java Extended
Java Extended
Challenge: Names Starting with Letter B
Завдання
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.
Дякуємо за ваш відгук!
Challenge: Names Starting with Letter B
Завдання
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.
Дякуємо за ваш відгук!
Challenge: Names Starting with Letter B
Завдання
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.
Дякуємо за ваш відгук!
Завдання
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.