• Post Reply Bookmark Topic Watch Topic
  • New Topic

Please help, cannot find symbol error  RSS feed

 
Eric Matthew
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



I keep getting this error when trying to compile. I also tried import java.util.Random; but that didn't work either. Not sure what I'm doing wrong. :[ Any ideas?


 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Do you have your own class named Math? If you have, then it is hiding the standard class Math from the java.lang package - the Java compiler picks up your own class Math which doesn't have a static method named random().

Rename or remove your own class Math.
 
Eric Matthew
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Oh my god. I did. I earlier tried to create a simple arithmetic program and named it Math, which I see was idiotic of me in hindsight lol, but simply deleting the java file worked for me. Thanks a bunch! You saved me a ton!
 
Campbell Ritchie
Marshal
Posts: 56527
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again

In future, please post the text rather than a screenshot. You can find out how to copy and paste here.
 
Campbell Ritchie
Marshal
Posts: 56527
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you think the likely output of that random() call will be? I mean the smallest number and the largest you will ever get.
I would prefer to use a Random object myself
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!