Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By mohsen.noor

Thread: run method doesn't show output

  1. #1
    mohsen.noor is offline Member
    Join Date
    Dec 2012
    Posts
    28
    Rep Power
    0

    Default run method doesn't show output

    Hi everybody
    When I run my code it doesn't show output
    It is only shown blank output
    Thanks in advance

    Java Code:
    public class DemoThread extends Thread  {
            @Override
            public void run(){
                            for(int i=0; i<10;i++)
                                    System.out.println("Thread id  "+getId()+  "Thread name "+getName()+"   Priority of Thread  "+getPriority());
    							
    				}
                
    	public static void main(String []args){
                    
                    Thread t1 = new Thread();
                    Thread t2 = new Thread();
                    t1.setName("High priority");
                    t1.setPriority(MAX_PRIORITY);
                    t2.setName("Low priority");
                    t2.setPriority(MIN_PRIORITY);
                    t1.start();
                    t2.start();
                    }
    		
    		}
    Last edited by mohsen.noor; 02-03-2014 at 10:32 AM.

  2. #2
    mohsen.noor is offline Member
    Join Date
    Dec 2012
    Posts
    28
    Rep Power
    0

    Default Re: run method doesn't show output

    problem solved thanks

    Java Code:
                    
                    Thread t1 = new DemoThread();
                    Thread t2 = new DemoThread();
    kjkrum likes this.

  3. #3
    Ajk_P is offline Member
    Join Date
    Feb 2014
    Posts
    2
    Rep Power
    0

    Default Re: run method doesn't show output

    Haha yeah, you might also want to try to use runnables:
    Threads and Runnables

Similar Threads

  1. JScrollBar doesn't show thumb
    By hoangdise in forum AWT / Swing
    Replies: 1
    Last Post: 10-27-2011, 01:01 PM
  2. Subreport doesn't show in the PDF
    By sandy1991tje in forum Advanced Java
    Replies: 0
    Last Post: 06-10-2011, 03:45 PM
  3. JList doesn't show the elements
    By mrbeast87 in forum AWT / Swing
    Replies: 2
    Last Post: 04-20-2011, 07:21 PM
  4. Animation doesn't show when used as action?
    By ryuzog in forum New To Java
    Replies: 1
    Last Post: 01-04-2010, 02:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •