Tuesday 25 September 2012

Java Beginner : Strings and Arrays - Sort a user inserted string


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication4;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 *
 * @author Sunshine
 */
public class JavaApplication4 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        
        System.out.println("Please enter the text");
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String inp = br.readLine().toLowerCase();
        char[] input=inp.toCharArray();
        Arrays.sort(input);
        
            System.out.println(input);
       
        
    }
}



No comments:

Post a Comment