I'm exercising static keyword. I've declared a static method whose return type is class. when I access this method from main method is gives me following error. How can I return the object from this method?
error: non-static variable this cannot be referenced from a static context
return this;
Following is my code
public class StaticKeyword{
public static StaticKeyword run(){
return this;
}
public static void main(String args[]){
System.out.println(StaticKeyword.run());
}
}