|
Answer» Hello,
I've written a simple java program which has a string of names:
import java.util.Random;
public class RandomNames { public static VOID main(String[] args) { String[] Names = {"Bob","John","Mary","Lewis", "Hannah", "GEORGE", "Sam", "Carl"}; Random r = new Random(); int randint = r.nextInt(Names.length); System.out.println("Your NAME is" +Names[randint]+""); } }
I'd like the program to record each time it prints out who's name is called, so..
Hannah - 4 times George - 2 times Carl - 1 time
You GET the PICTURE.. also, how can i write this output to a file?
Thanks in advance
|