1 Replies - 348 Views - Last Post: 23 August 2010 - 08:28 PM Rate Topic: -----

#1 ashwinp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-August 10

error in java code & saving name

Posted 23 August 2010 - 08:21 PM

class NewThread extends Thread1
{
	NewThread()
	{
		super("demo thread:");
		System.out.println("child Thread:"+this);
		start();
	}

	public void van()
	{
		try
		{
			for(int i=5;i>0;i--)
			{
				System.out.println("child Thread:"+i);
				Thread.sleep(500);
			}
		}

		catch(InterruptedException e)
		{
			System.out.println("child Thread");
		}
		System.out.println("exiting child");
	}
}

class Three
{
	public static void main(String str[])
	{
		new Thread();
		try
		{
			for (int i=5;i>0;i--)
			{
				System.out.println("main Thread:"+i);
				Thread.sleep(1000);
			}
		}
		catch(interruptedException e)
		{
			System.out.println("main Thread......");
		}
		System.out.println("exiting Thread");
	}
} 




Please format indent your code properly and :code:

This post has been edited by pbl: 23 August 2010 - 08:26 PM
Reason for edit:: Code tags added


Is This A Good Question/Topic? 0
  • +

Replies To: error in java code & saving name

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8315
  • View blog
  • Posts: 31,836
  • Joined: 06-March 08

Re: error in java code & saving name

Posted 23 August 2010 - 08:28 PM

Not knowing if Thread1 extends Thread not easy to say if the start() method is appropriate
And all flavors of Exception, as all Java classes, start with a Capital letter
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1