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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started