How to add a method to MyStringClass to reverse the string without
importing the Java string library?
import java.util.Scanner; class MyStringClass { public String getString() { // Get console String input System.out.print("Enter a String: "); Scanner in = new Scanner(System.in); String str = in.nextLine(); return (str); } } public class SweetPee { public static void main(String args[]){ System.out.println("How to add a method to MyStringClass to reverse the string without using Java string library?"); String reverseStr; // create object instance MyStringClass myStrObject = new MyStringClass(); // get string from console String str = myStrObject.getString(); System.out.println("You entered this string: " + str); // show reversed string from console System.out.println("The string reversed is: " + reverseStr); } }