need help with Static and non-static methods and feilds

Joined
Apr 9, 2009
Messages
1
Reaction score
0
Hello, I was hoping someone could help.

I have a variable in a class that I would like to call in another class in the same package. However when I try calling it I get an "non-static variabe cannot be referenced from a static context". Now my bandaid solution was to just make the variable static and move on with my life. Unfortunatly I'm not allowed to do that. is there any other way for these classes to talk to each other with the variables being static?

I'm also running into the same issue with calling methods from a different class. it gives me the same error saying that method has to be static.

I can post the code if it'll help to understand what im saying

any input would help.. thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,187
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top