views:

292

answers:

4

What does "inline thread" mean?

I got this question during my latest interview. Anybody used this?

+5  A: 

I believe it refers to the practice of creating an anonymous class extending Thread and calling its start method in the same line of code.

(new Thread() {
  public void run() {
    // do stuff
  }
 }).start()

As stated elsewhere, this is not an "official" Java term. But I think it's still good to know how concepts might be referred to differently, if only for the sake of communication.

danben
+2  A: 

It's really just another name for an anonymous thead.

( new Thread() { public void run() { 
// do something 
} } ).start(); 
Pace
+7  A: 

"inline thread" is not an established term in Java. It was a bad question.

Some people seem to use the term to mean threads defined using anonymous classes, as shown in the other answers. But again, this is not official or even widespread usage, and not something by which you could usefully measure someone's Java knowledge.

Michael Borgwardt
Some people may consider it a reasonable question to assess the candidates ability to interactively clear up botched communications.
Tom Hawtin - tackline
+2  A: 

I am guessing this means creating a thread sorta like...

new Thread(
  new Runnable() {

      public void run() {
         ...
      }
}).start();
Ascalonian