Hi dude , your code is good and simple but I HAVE A QUESTION , will there be any difference if i call the StringThread.run method directly ???

ie


Code: Java

Code:
class PrintString
{
    public static void main (String args [ ])
    {
        StringThread t = new StringThread ("Java",50);
       // new Thread(t). start ( );   instead of this i do :
        t.run();
    }
}   

class StringThread implements Runnable
{
    private String str;
    private int num;

    StringThread(String s, int n)
    {
        str  = new String (s);
        num =n; 
    }
   
    public void run ( )
    {
        for (int i=1; i<=num; i++)
            System.out.print (str+" "); 
    }
}
If no , why are u doing so ??? please reply asap ! ..

Last edited by shabbir; 4Sep2011 at 20:42.. Reason: Code blocks