Write Method Takes String Parameter Returns String Follows Every Uppercase Lowercase Every Q37147869

Write a method that takes a string as its parameter and returnsthe string as follows:

Every uppercase to lowercase and every lowercase to uppercase.(Use API).

Example: given “Hello” should returns “hLLO”.


Solution


import java.util.Scanner;public class FlipCase { public static String flipCase(String s) { String result = “”; for (int i = 0; i <s.length(); i++) { if (Character.isLowerCase(s.charAt(i))) {

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.