Question: Write a method that has one String input parameter and returns a String. The returned String must be the reverse of the input String. For
Write a method that has one String input parameter and returns a String. The returned String must be the reverse of the input String. For instance, if the input String is "Open sesame" the returned String must be "emases nepO". Your method must be static and public, with name reverseString().
public class Main { // TODO: Write your method to reverse an input String here:
// Do not modify this main() method, it is needed by the tests. // Main method to call the reverseString() method. public static void main(String[] args) { System.out.println(reverseString("Open sesame")); System.out.println(reverseString("abracadabra")); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
