|
-
Feb 2nd, 2003, 11:50 PM
#1
Thread Starter
Addicted Member
main function, static>non-static?
i have some code here..
Code:
public void main(String args[]) {
......"some code here"
}
public void readTiles() {
......"some code here"
}
but i get the error
** FileClassTester.java:4: non-static method read() cannot be referenced from a static context **
why? what? i'm just accessing another function from the main function? i've done that a 100 times before? even if there's no code in readTiles() it give me an error.
--770
-
Feb 3rd, 2003, 03:48 AM
#2
Addicted Member
Try that
public void main(String[] argv) {
-
Feb 3rd, 2003, 10:50 AM
#3
Hyperactive Member
public static void main(String args[])
-
Feb 3rd, 2003, 11:40 AM
#4
Thread Starter
Addicted Member
i've tried that with staitc or without..
if it's without, it says that i need a main function, if it's with, i can't call the other function?? ***??
--770
-
Feb 3rd, 2003, 12:10 PM
#5
Hyperactive Member
can you post your entire code?
-
Feb 3rd, 2003, 04:19 PM
#6
That is the nature of the language. Static members can only access other static members.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|