use this

import javax.swing.JOptionPane;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Ranz
 */
public class Reverse {

    public Reverse() {
        StringBuilder input = new StringBuilder(
                JOptionPane.showInputDialog("Input: "));
        JOptionPane.showMessageDialog(null, input.reverse().toString());
    }

    public static void main(String[] args) {
        new Reverse();
    }
}



2012/4/2 Nick Ranario <[email protected]>

>
> import java.util.ArrayList;
> import java.util.Arrays;
> import java.util.Collections;
> import javax.swing.JOptionPane;
>
> /*
>  * To change this template, choose Tools | Templates
>  * and open the template in the editor.
>  */
> /**
>  *
>  * @author Ranz
>  */
> public class Reverse {
>
>     public Reverse() {
>         String input = JOptionPane.showInputDialog("Input: ");
>         String splitWhen = " ";
>         String[] splitInput = input.split(splitWhen);
>         ArrayList newInput = new ArrayList();
>         newInput.addAll(Arrays.asList(splitInput));
>         Collections.reverse(newInput);
>         JOptionPane.showMessageDialog(null, newInput);
>     }
>
>     public static void main(String[] args) {
>         new Reverse();
>     }
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to