Hang on...
Reverse a string
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
andstatic
. - It must be named
reverseString
. - It must return a
String
. - It must take a single
String
parameter.
Examples:
- If your method is called with
reverseString("codedamn")
, it should returnnmadedoc
. - If your method is called with
reverseString("123")
, it should return321
.
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!
Adding your container request
Getting your dedicated container
Connecting to your container
Setting up your editor
Finalizing your playground
TerminalEditorBrowser