Ask Question
17 October, 14:15

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.

+2
Answers (1)
  1. 17 October, 15:57
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers