Assume we are making a simple dice game which to create random numbers each roll and here is the function and the program.
import java.util.Random;
public class Apples {
public static void main(String[] args){
int face;
Random randomNumbers = new Random();
for ( int counter = 0; counter <=20; counter ++){
face = 1 + randomNumbers.nextInt(6);
System.out.printf(" %d " , face );
System.out.println();
}
}
}
Class is getting interesting , looking forward to each next class . xD
ReplyDelete