The Artima Developer Community
Sponsored Link

Java Answers Forum
What is wrong? Help please

2 replies on 1 page. Most recent reply: Mar 1, 2004 5:33 AM by Adam Duffy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Nancy

Posts: 11
Nickname: ac121107
Registered: Feb, 2004

What is wrong? Help please Posted: Mar 1, 2004 1:16 AM
Reply to this message Reply
Advertisement
When trying to compile I get an error message that says"illegal start of expression" and it points at play.
I do not understand why.

public void play()
    {
		int die1.die2,die3,sum;
		rolls++;
	    die1 = 1 + (int) (Math.random() * 6);
		die2 = 1 + (int) (Math.random() * 6);
		die3 = 1 + (int) (Math.random() * 6);
		sum =  die1 + die2 + die3;	


Thank you


Viswanatha Basavalingappa

Posts: 84
Nickname: viswagb
Registered: Nov, 2003

Re: What is wrong? Help please Posted: Mar 1, 2004 2:07 AM
Reply to this message Reply
Hey, Nancy,

I feel you have forgotten to close the braces "}"
public void play()
    {
		int die1.die2,die3,sum;
		rolls++;
	    die1 = 1 + (int) (Math.random() * 6);
		die2 = 1 + (int) (Math.random() * 6);
		die3 = 1 + (int) (Math.random() * 6);
		sum =  die1 + die2 + die3;	
    }


I hope it helps
Viswa
---------

Adam Duffy

Posts: 168
Nickname: adamduffy
Registered: Feb, 2003

Re: What is wrong? Help please Posted: Mar 1, 2004 5:33 AM
Reply to this message Reply
Watch out for the line

int die1.die2,die3,sum;



You have a period . instead of a comma , between variables die1 and die2

Adam

Flat View: This topic has 2 replies on 1 page
Topic: How to combine subfunction into Main Program Previous Topic   Next Topic Topic: How to remain at the main screen after perform some functions

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use