Hi all,
Im new to java.

I get this error.
Non-static variable this cannot be referenced from a static context
myClass c=new myClass()

this is my code

public class MyOwnBm{
private Hashtable myHash=new Hashtable();

public static void main(String[] args)
 myClass c=new myClass();

public class myClass{....}


PLZ... help me I've wasted hours on this.

Edited 4 Years Ago by coroll: n/a

are they in the same or in separate files?

They are in the same file.

your code is full of errors.
try creating MyClass (or myClass, if you prefer) in a separate java file, and since you call a match method on it, make sure that method exists.

You declared MyClass inside MyOwnBM, and you didn't declare it static, so it's just like any other instance member - you can't refer to it without an instance of the MyOwnBM class. See
Unless MyClass needs direct access to instance variables from MyOwnBM, just declare it static, or declare it outside MyOwnBM.

thank you. i made it static

This question has already been answered. Start a new discussion instead.