Re: Beginner for Java, need help with this code I wrote
Your IDE is executing the java command with a classname. It builds a commandline:
java <classnamehere>
The contents of the error message makes it look like the classname being used is: Cards$Suits
Somewhere in the IDE you specify what classname is to be used. I have no idea how to setup your IDE so that it picks the correct classname to use.
The classname to use should be changed to Cards.
Re: Beginner for Java, need help with this code I wrote
Oh....
Well, it was already defined as Cards, see:
Code java:
public class Cards {
enum Suits { Club, Diamond, Spade, Heart }
public static void main(String[] arg) {
Re: Beginner for Java, need help with this code I wrote
Here is an example of the use of the java command with the wrong classname and the right one:
Code :
Microsoft Windows XP [Version 5.1.2600]
D:\JavaDevelopment\Testing\ForumQuestions8>java Cards$Suits <<<<<<<<< THE WRONG classname
Exception in thread "main" java.lang.NoSuchMethodError: main
D:\JavaDevelopment\Testing\ForumQuestions8>dir Cards*
Volume in drive D is Work
Volume Serial Number is 0C24-B38C
Directory of D:\JavaDevelopment\Testing\ForumQuestions8
02/13/2012 09:39 PM 1,024 Cards$Suits.class
02/13/2012 09:39 PM 1,228 Cards.class
02/13/2012 09:41 PM 996 Cards.java
3 File(s) 3,248 bytes
0 Dir(s) 7,020,515,328 bytes free
D:\JavaDevelopment\Testing\ForumQuestions8>java Cards <<<<<<<<<<< The correct classname
I'm thinking of a suit. Can you guess what it is?You got it wrong.
D:\JavaDevelopment\Testing\ForumQuestions8>
The error message you are getting must be coming from your IDE.
You'll need to ask someone why it gives that error message. The javac compiler does not give any errors when compiling your code.
Re: Beginner for Java, need help with this code I wrote
Hmmm.......
Alright, I just don't know who to ask.
Re: Beginner for Java, need help with this code I wrote
The forum has an IDE section. Try asking there.
Java IDEs
Re: Beginner for Java, need help with this code I wrote