Write a program that prompts the user to enter a string and displays the string in reverse order.
public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a string: "); String s = input.nextLine(); input.close(); StringBuffer buffer = new StringBuffer(s); System.out.print(s + " in reverse is " + buffer.reverse()); }
Enter a string: A bugs life A bugs life in reverse is efil sgub A