• Post Reply Bookmark Topic Watch Topic
  • New Topic

help trying to scanner  RSS feed

 
mitchell cooper
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what am i doing wrong !





 
mitchell cooper
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im getting error when i run i think its because main is in a class but where can i more it ?
 
Ron McLeod
Saloon Keeper
Posts: 1600
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you provide some details on what problem you are having?

Age
98
Enter your name
Bob
Age:98 name:Bob
 
mitchell cooper
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it just says i have errors when i run it does not state anything specific
 
mitchell cooper
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think it may be because main is in a class but dont know how to fix it
 
Liutauras Vilda
Marshal
Posts: 4650
318
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi mitchell,

Ron confirmed that program runs without errors, I tried also, it runs just fine. Please tell us exactly what kind of error you're getting? There are more problems in your code, but those should not be crucial at the moment. Later on it would require to be fixed, i have in mind your program structure, identation, methods naming, class naming, and some other tinny ones.
 
Ron McLeod
Saloon Keeper
Posts: 1600
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mitchell -- please share the exact command lines that you are using to compile, and then to run.
 
mitchell cooper
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i run it, it says .... errors exist in required project. ok well if there are a few things wrong with it i would love a few pointers if its not much trouble.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mitchell cooper wrote:when i run it, it says .... errors exist in required project.

So you're using an IDE. Which one?

How many .java files do you have in that project?
 
Campbell Ritchie
Marshal
Posts: 55761
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never never close a Scanner pointing to System.in. Not even if Eclipse suggests you should.
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like there is an error or errors in another Java files in that project. Check all the other files for errors. If you're on Eclipse, there will be a red star shape on the files in the Project Explorer that have errors.
 
Campbell Ritchie
Marshal
Posts: 55761
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the error is in another class, then Eclipse will happily run that code (with warnings).
 
Liutauras Vilda
Marshal
Posts: 4650
318
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And those discussions probably suggests that OP is not ready for the Silicon Valley like technologies (IDE). Decent text editor and command line compiler would be the way to go probably, so such a errors wouldn't appear anymore.
mitchell cooper, luckily CodeRanch got FAQ (<- link to click on) for that.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!