is the inner class must be static in java?
- by Praveen Chandrasekaran
i created a non static inner class like this
class sample{
public void sam(){
System.out.println("hi");
}
}
called it in main class like this:
sample obj=new sample();
obj.sam();
it throws an exception: non-staic class context like that? when i put the both object and class as static. it works.why?