Answer Posted / s.ramesh
import java.util.*;
public class DemoThread extends Thread {
private Thread t = null;
public DemoThread() {
t= new Thread(this, "RacingThread");
t.start();
}
public static void main(String[] args) {
DemoThread dt = new DemoThread();
dt.setName("DemoThread");
dt.start();
}
public void run()
{
while(true)
{
try
{
this.sleep(5000);
}
catch(Exception e)
{
System.out.println("Exception Occured");
}
}
}
}
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is ioc concept?
What are JTA/JTS and how they used by client?
how to make a index.jsp for running the site in internet and find an error for connection with weblogic server and java that give an error invalid object name.and how to maintain session.
How would you create a button with rounded edges?
Have you used threads in Servelet?
Which textcomponent method is used to set a textcomponent to the read-only state?
Whats new with the stop(), suspend() and resume() methods in jdk 1.2?
What are the benefits of detached objects?
What are the different types of exception?
What is a modular application?
How can I scroll through list of pages like the search results in google?
How would you reatach detached objects to a session when the same object has already been loaded into the session?
Why are component architectures useful?
What is the purpose of the wait(), notify(), and notifyall() methods?
What’s jboss cache in short?