See the commented line below.
what is the scope of ref in the following program?
In which scenario we will use those declarations?
class MyClass {
static MyClass ref;//is this valid?
String[] arguments;
public static void main(String args[])
{
ref= new MyClass();
ref.func(args);
}
public void func (String[] args)
{
ref.arguments=args;
for(int i=0;i<arguments.length;i++)
{
System.out.println(arguments[i]);
}
}
}
}