Reverse a string

Easy
102
4
77.4% Acceptance

In this lab, your task is to implement a reverseString method that takes a string as input and returns its reverse without using any built-in string reversal functions. This method should be static and part of a class named Main.

Your method should satisfy the following conditions:

  • It must be public and static.
  • It must be named reverseString.
  • It must return a String.
  • It must take a single String parameter.

Examples:

  1. If your method is called with reverseString("codedamn"), it should return nmadedoc.
  2. If your method is called with reverseString("123"), it should return 321.

Ensure that your method handles these cases correctly and does not rely on any built-in string reversal methods provided by Java or its libraries. Good luck!