We are going to make one program on the dice roller in which the number in the dice will be selected randomly.
To make a program over this firstly we need to make a class DiceRoller in which we will have a doGet() method in which we will have our application logic. To make the dice working randomly use the random() method of the class java.lang.Math. To print the number on the browser call the method getWriter() of the response object which will return the PrintWriter object. Now by the object of the PrintWriter class print the values of the dice on the browser.
The code of the program is given below:
XML File for this program:
The output of the program is given below:
Posted on: July 13, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles