Search:

Type: Posts; User: angstrem

Search: Search took 0.08 seconds.

  1. Replies
    11
    Views
    6,223

    Re: Creating a Thread from a Thread

    Norm, jps, thank you very much! Now I see it. Actually, it becomes very, very obvious in a debugger. So in the first iteration we had a direct call to the target run() method. At the end of this...
  2. Replies
    11
    Views
    6,223

    Re: Creating a Thread from a Thread

    But if I pass a Runnable to a Thread constructor, the Runnable's run() method will be called on thread's start. Thread implements Runnable. Hence, when I say t = new Thread(t) the new thread must run...
  3. Replies
    11
    Views
    6,223

    Re: Creating a Thread from a Thread

    OK, here's the full code:



    public class Program {

    public static void main(String[] args) throws InterruptedException {
    Thread t = new Thread(){
    public void run(){...
  4. Replies
    11
    Views
    6,223

    Re: Creating a Thread from a Thread

    In fact, this already is a small, complete program. Just wrap the code in the main method and that's it.
  5. Replies
    11
    Views
    6,223

    Creating a Thread from a Thread

    I have the following code:


    Thread t = new Thread(){

    public void run(){
    System.out.println("I'm called!");
    }

    ...
Results 1 to 5 of 5