Answer the question
In order to leave comments, you need to log in
What does t == this mean in code?
I don't understand how to understand the code t == this. creatorThread variable of type Thread. This class extends Thread.
Thread t = Thread.currentThread();
if ( t == creatorThread ) {
System.out.println(“Creator thread”);
} else if ( t == this ) {
System.out.println(“New thread”);
}
Answer the question
In order to leave comments, you need to log in
Thread t = Thread.currentThread();
if ( t == creatorThread ) {
System.out.println("Creator thread");
} else if ( t == this ) {
System.out.println("new thread");
}
In general, the code is... elegant, but complicated. (purely my opinion)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question