is the inner class must be static in java?
Posted
by Praveen Chandrasekaran
on Stack Overflow
See other posts from Stack Overflow
or by Praveen Chandrasekaran
Published on 2010-05-20T13:22:05Z
Indexed on
2010/05/20
13:30 UTC
Read the original article
Hit count: 262
java
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?
© Stack Overflow or respective owner