Tarrell Fletcher wrote:Ok got it to work somewhat. I just declared "public static String number; "...
A really bad habit to get into.
First of all,
static variables are NOT instance variables; second, making all your variables
static defeats the whole purpose of the language, which is to deal with
objects; third, you should make variables
private unless you've got a
really good reason not to, and doubly so when they're
static.
For the moment, a good mantra for you, from 'Animal Farm':
private variables good;
public variables bad.
If you need to access the variable, provide getters and setters for it (and they
can be
public), viz:
and now your
main() might look something like:
HIH
Winston