1 Replies - 375 Views - Last Post: 07 October 2012 - 02:23 PM Rate Topic: -----

#1 Kooky_Lukey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-October 12

Petals around the rose random number

Posted 07 October 2012 - 02:20 PM

the error says illegal start of type and ive looked at a ton of other random number generators and i just cant seem to understand them. any kind of help would be glorious thank you.

import java.util.Random;
/**
 * Petals Around the Rose Game
 * 
 * @author  
 * @version October 7, 2012
 */
public class PetalsGame
{
    // get random number
Random diceRoller = new Random();

for (int i = 0; i < 5; i++) 
{
  int roll = diceRoller.nextInt(6) + 1;
  System.out.println(roll);
}
}




Is This A Good Question/Topic? 0
  • +

Replies To: Petals around the rose random number

#2 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2198
  • View blog
  • Posts: 5,226
  • Joined: 10-September 10

Re: Petals around the rose random number

Posted 07 October 2012 - 02:23 PM

Generally, with some exceptions that probably don't apply in this case, the statements between lines 13 and 17, inclusive, should be in a method.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1