public class FirstClass
{
private FirstClass()
{
new Thread(new Thread()).start();
}
public static void checkSomething(FirstClass clas)
{
//doing something
}
private class Thread implements Runnable
{
@Override
public void run() {
checkSomething(????);
}
}
public static void main(String[] args)
{
new FirstClass();
}
}
my question is, what to write in ???? to get class FirstClass, i cannot write “this”, coz i would get Thread.
You can write
FirstClass.thisto access the enclosing class instance.