What about the objects which we define outside static method ? how to use them ? Example:=> In the following code how to use object "obj1". I know "obj1" can't be used in static methods. But it can be used in non-static methods. So, How to use "obj1" in method "nonstatic" ?
Code:=>
class Test {
int a,b;
String name;
Test obj1=new Test();
public void nonstatic(){}
public static void main(String[] args){
System.out.println("How to use obj1");
}
}