Problems with static methods

Having problems with these two methods:

publicclass Skills{

/** Other code here */

publicstatic Hashtable makeSkills(){

/** code adding 69 elements to a HashTable */

}

/** more irrelevant stuff here too */

}

private String[] skillsModel(){

String[] a =new String[70];

int i =0;

Enumeration e = (Skills.makeSkills()).keys();

while(!e.hasMoreElements()){

a[i]= (String)e.nextElement();

}

}

Any ideas?

[1071 byte] By [wihatcha] at [2007-11-27 10:51:40]
# 1

Changewhile(!e.hasMoreElements()){

towhile(e.hasMoreElements()){

And add an i++ as the last statement in the while loop.

And in the future, try to be more clear in your posts. People around here generally don't want to guess at what your problem is.

dwga at 2007-7-29 11:32:50 > top of Java-index,Java Essentials,New To Java...
# 2

Oh wait, forgot to post the problem. I knew I forgot something....

edit: How do I edit the OP? Problem with it is I get this error:

symbol : method makeSkills()

location: class javax.swing.JComboBox

Enumeration e = (Skills.makeSkills()).keys();

Message was edited by:

wihatch

wihatcha at 2007-7-29 11:32:50 > top of Java-index,Java Essentials,New To Java...
# 3

> Oh wait, forgot to post the problem. I knew I forgot

> something....

>

> edit: How do I edit the OP?

You can't once it's been replied to.

> Problem with it is I get

> this error:

>

> symbol : method makeSkills()

> location: class javax.swing.JComboBox

> Enumeration e =

> (Skills.makeSkills()).keys();

That's not the entire error is it?

That would imply that the class Skills has no method named makeSkills, are you sure their spelled the same (remember case matters)?

dwga at 2007-7-29 11:32:50 > top of Java-index,Java Essentials,New To Java...
# 4

Note: C:\Documents and Settings\William Hatch\ShadowRun\src\Skills.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

1 error

BUILD FAILED (total time: 0 seconds)

That's the rest of it. Both classes are in the same folder. It's annoying me to tears.

wihatcha at 2007-7-29 11:32:50 > top of Java-index,Java Essentials,New To Java...
# 5

Are you compiling on the command line?

If so, is your classpath correct?

Is this what you dojavac -classpath . ClassName.java

?

dwga at 2007-7-29 11:32:50 > top of Java-index,Java Essentials,New To Java...
# 6

Ok I feel like an idiot, had a combo box in the code called "Skills" already. Serves me right for using such crappy variable names.

wihatcha at 2007-7-29 11:32:50 > top of Java-index,Java Essentials,New To Java...
# 7

Conventionally variables should begin with a lower-case letter while class names begin with an upper-case letter.

dwga at 2007-7-29 11:32:50 > top of Java-index,Java Essentials,New To Java...