Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scanner class import issue

 
Ben Hultin
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a class assignment (not a java class... well it is a class on java, but not the meaning java has for class) and I am trying to get my program to allow user input from the command prompt. The problem is I keep getting errors about the import syntax saying that nothing is in the right place.




The program goes on, but I feel it is not important for the issue at hand. I appreciate any help on the matter
 
Maneesh Godbole
Saloon Keeper
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Move line #5 (import statement) to line# 1 (before public class HultinBenProg4)
 
Ben Hultin
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, no more errors, program compiles fine
 
Campbell Ritchie
Sheriff
Pie
Posts: 49382
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you taking classes in Java, or classes about Java classes, or Java classes about classes?

More seriously, although the Sun style guide is 10 years old, the order of parts of a class is still accurate. You may omit parts of the order; for example it mentions public fields, but as a design principle most classes only have private fields, so you simply ignore that part. Also in class exercises about classes in class ( ) you may not have time to write all your documentation comments.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic