Ask Question
8 September, 03:39

Write a method called listUpper () that takes in a list of strings, and returns a list of the same length containing the same strings but in all uppercase form. You can either modify the provided list or create a new one.

+3
Answers (1)
  1. 8 September, 05:33
    0
    public static List listUpper (List list) {

    List upperList = new ArrayList ();

    for (String s:list) {

    s = s. toUpperCase ();

    upperList. add (s);

    }

    return upperList;

    }

    Explanation:

    Create a method named listUpper that takes list as a parameter

    Inside the method, initialize a new list named upperList. Create a for-each loop that iterates through the list. Inside the loop, convert each string to uppercase, using toUpperCase method, and add it to the upperList.

    When the loop is done, return the upperList
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a method called listUpper () that takes in a list of strings, and returns a list of the same length containing the same strings but ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers