Adam Chalkley wrote:Thanks for the reply but no that didn't work =(
I suspect because you didn't understand what James was trying to tell you.
I tried to declare the variable or object outside the main method but go a lot more errors this time than one.still confused on why this isn't working
Did you declare that variable as
static? If not, then
main() won't be able to "see" it.
However, that's not a "solution path" you want to go down. Declaring
static variables is almost invariably WRONG.
Basically, you need to create
objects.
Java is an
Object-Oriented language, so it works best when it has objects to work with; so, in your case, you may need to set up a
mainn object as a "launcher".
Alternatively, have a look at the
MainIsAPain page for a slightly different approach.
Also:
1.
You should read up on Java
naming conventions. Classes should always start with a CAPITAL letter; fields and methods with a lower-case one.
2. Check out the
StopCoding (←click) page. Right now, you seem to be bashing out code and expecting it to work; and that
just won't happen. Programming requires
thought - especially with something as involved as a stock system - so you need to plan how you're going to achieve your goals.
HIH
Winston
PS: Please
UseCodeTags (←click) when you post code. I've added them for you this time - see how much better it looks?