Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes Scanner class import issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Scanner class import issue" Watch "Scanner class import issue" New topic

Scanner class import issue

Ben Hultin
Ranch Hand

Joined: Aug 17, 2009
Posts: 135
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

Joined: Jul 26, 2007
Posts: 10824

Move line #5 (import statement) to line# 1 (before public class HultinBenProg4)

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Ben Hultin
Ranch Hand

Joined: Aug 17, 2009
Posts: 135
Thanks a lot, no more errors, program compiles fine
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46349
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.
I agree. Here's the link:
subject: Scanner class import issue
It's not a secret anymore!