"Non-static method cannot be referenced from a static context" ?
Joined: Apr 23, 2004
I got a class in which I want to call three methods. The problem is as stated in the subject of this post. I got no clue whatsoever of what I should to to make it work. Anyway, heres the code:
Would anyone please tell me what to do? And if you want to help out further, I would like some help with the method "reverseArrayOrder". The point with this one is, as the name suggests, to reverse the array order. I either need a way to copy the matrix that comes with the method-call, or I need to create an empty matrix with the same size and use this to temporarily store contents of the arrays while moving their contents around. Right? I've thought of using an ArrayList, but I can't come up with a way to make it work...
Greg T Robertson
Joined: Nov 18, 2003
You are attempting to call the eraseMatrixValues from the static method "main". If you did
Reason is that you can't call "non static" methods from a static method. As an alternative you could make the methods all static. As an aside classes are usually named with the first letter as a capital. [ May 10, 2004: Message edited by: Greg T Robertson ]
I had this problem when I was working with an object earlier. I kept on getting this error popping up when I kept on trying to write and retrieve data from the class file instead of the object I had created from the class..