Matt Pociask
Posts: 9
Nickname: mpociask
Registered: Aug, 2003
|
|
Re: How do you get input from the keyboard?
|
Posted: Aug 14, 2003 8:13 PM
|
|
Are you familiar with object oriented programming and how it is implimented in java? The modifier, static, before your main method says that whenever you create an instance of your class and call that method, the method and its variables a common to each instance of that class. You cannot have variables that aren't common to each class (non-static) refereced from a method that is common to each class (static), becase the static method won't know which version of that variable to use.
Try adding the following to your code:
public class foobar {
// Your existing code
}
Change foobar to whatever you named your file. (without the .java part)
Also, don't include java.lang.*, java.lang.Object. They are imported automatically. Also, I don't think you need the IO package, but you might need it for the BufferedReader class.
I hope this helps. If the first paragraph is way over your head, you need to brush up on object oriented design.
Good luck!
|
|