Answered You can hire a professional tutor to get the answer.

QUESTION

Write a method that takes a String as input and returns a String containing the middle character of the String if the length of that String is odd.

Write a method that takes a String as input and returns a String containing the middle character of the String if the length of that String is odd. If the length of the String is even, your method should return the middle two characters. For example, if the input String is "Hello" the method should return "l" and if the input String is "Worlds" the method should return "rl". In addition, write a main method that tests your method for a variety of String values.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question