Reverse a string

The problem

Write a program that prompts the user to enter a string and displays the string in reverse order.

Breaking it down

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());
}

Output

Enter a string: A bugs life
A bugs life in reverse is efil sgub A