Kamis, 23 Februari 2012

Random Huruf (JAVA)

import java.util.Random;
public class RandomHuruf
{
    public static void main(String[] args)
    {
        String array[] = {"a", "b", "c", "d", "e", "f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
        Random r = new Random();
        int index = r.nextInt(array.length);
        String result = array[index];
        System.out.print(" "+result+"\n");
    }
}
//use "RandomHuruf" for file name

Load comments