Possible Duplicate:
Can “this” ever be null in Java?
I have thread with thic code:
@Override
public void run() {
try {
process();
} finally {
Factory.close(this);
}
}
is there option that this
can be null
?
Possible Duplicate:
Can “this” ever be null in Java?
I have thread with thic code:
@Override
public void run() {
try {
process();
} finally {
Factory.close(this);
}
}
is there option that this
can be null
?
is there option that this can be null
No. this
reference cannot be null
. It will always point to the Thread instance currently executing that code.
No nothing is at least wrong here. THIS is never null in JAVA. May be your problem is somewhere else. Try to submit more code
this
cannot be null
anywhere in Java, null
means it points to no object, (it's just a junk variable). this
means, in the object, you are now implementing, it should point to itself.