|
-
Nov 27th, 2002, 01:38 PM
#1
Thread Starter
Addicted Member
problem compiling class
I've got a class (ArrayMenu) which uses class (Keyboard) to read which key is pressed to choose from a menu. Keyboard compiles but ArrayMenu has this error (and I don't understand what I've done wrong!) Any one help - please!
---------- javac ----------
ArrayMenu.java:33: cannot resolve symbol
symbol : variable Keyboard
location: class ArrayMenu
choice = Keyboard.readChar();
^
1 error
Output completed (1 sec consumed) - Normal Termination
If anyone wants to see the code for the classes I will post them
-
Nov 27th, 2002, 07:41 PM
#2
Hyperactive Member
remove the package statement at the top of the keyboard.java file. then recompile keyboard.java, and place it in the same directory as ArrayMenu.java.
Good ol Java Software Solutions by Lewis and Loftus?
-
Nov 28th, 2002, 02:15 AM
#3
Thread Starter
Addicted Member
if I remove the package from Keyboard I get 6 errors and it will not compile. ArrayMenu will still not compile. They are both in the same directory
-
Nov 28th, 2002, 05:54 PM
#4
Hyperactive Member
You must not have the one i was thinking of. sorry dude.
-
Nov 29th, 2002, 03:53 AM
#5
Addicted Member
Is readChar() a static method?
I ask because you've used Keyboard.readChar(). This means (I think) that it needs to be static. If its not then I think that the compiler tries to resolve Keyboard as a variable and not a class.
If its not static you need to declare a variable of typ Keyboard first.
If its not this problem then have you imported the class - it shouldn't be a problem cos they're in the same directory - but you never know. Are they in the same package?
I've asked a few questions as I'm not sure whats happening. If you need more help, give us a shout.
HD
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|