Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+12 votes

For some reason under the rollDie method of part A, randGen is always showing an error. I have imported both java.util.* and java.util.Random. Can someone help me if they ran into the same problem or know what might be wrong?

asked in CSC305 Fall 2022 by (1.9k points)
reshown by
+5

Do you think you can provide a code sample of the pertinent line that's giving an error? The error message itself would also be appreciated.

2 Answers

+6 votes

Actually nvm I solved it I wasnt creatinf instance of my random class haha

answered by (1.9k points)
+6 votes

Pro tip: In Eclipse, if you hover the mouse over the code that’s got the red underline (or if you hover it over the red x on the left side), it will give you a tip as to why it isn’t working.

It’s hard to answer this without knowing what the error is or seeing the code, but have you actually created a Random object i.e. Random example = new Random(); ?

answered by (596 points)
...