Hi, I am new to this site, so if this question has been asked before, which it probably has, please direct me to the appropriate forum.
I've done very little coding in my life but recently started studying Java 8 seriously. I bought the OCA Java SE 8 Programmer 1 study guide (I have bought more basic books), and I am at the part of Writing a main() method.
I created a new file called Zoo.java, as it asked, and I typed in the following code:
$ javac Zoo.java
$ java Zoo
I get the error message, 'Random cannot be resolved to a type
Random cannot be resolved to a type
It told me, if I got error messages, to check that I have installed a JDK, which I have, and to add it to the PATH, which I don't know what that means. It also suggested I come to this website. So here I am. What am I doing wrong?
I presume you got the error message after the first instruction
If you did, then you have installed Java® correctly and set the PATH correctly. That means there is an error in your code. There is something wrong with something called Random. By Random, do you mean this? If so, how did you import the Random class? I think incorrect importing is the most likely cause for that error message. Please show us your import declarations and also the line 5 which the tool is complaining about.
In case you got confused of multiple instructions given by Cambell Ritchie, please show us all *.java files you have for this application and their contents. Don't forget to UseCodeTags (<- link to click on) when you post code, it would make your code more readable.
And welcome to the Ranch again
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!