Using the new and improve DotComClass an error is coming at the command prompt like this.Can you please tell me how to get rid of that error.
SimpleDotCom.java:18:class,interface or enum expected
Jeff Verdegan wrote:All the imports in a .java file have to go at the top of that file. The only thing that can come before them is the package statement and comments.
This is why the error message says, "class,interface or enum expected." Those are the only things that can appear where you've put that import statement.
Pay close attention to the error messages, they usually tell you exactly what's wrong, even if it's not immediately obvious at first glance what they're saying.
I understood you and did that.I did some corrections and the .java file compiled without any error but the error began in the output
Here is my code..Is My conversion of the int random numbers into string and using in checkyourself method is wrong?If not then why the output error..the program gets stuck asking-enter the number perpetually.
Normally, you put classes in separate source files. So, instead of putting this all in one source file, you should create three separate files, named GameHelper.java, DotCom.java and SimpleDotComGame.java, that contain these three classes respectively.
Note that for public classes (your classes are not public), it's required to have them in a source file that has the same name as the class name; you cannot have more than one public class per source file.