Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Cesar Gonzalez   on Jan 12 In Java Category.

  
Question Answered By: Ethan Evans   on Jan 12

If you're just using the sleep  method in Thread class, you don't have
to extend the Thread class especially you are already extending the
Applet class. Try this sample:

public class SampleSleep {
//Put the throws Exception class to the calling method
public static void main(String[] args) throws Exception {
System.out.println("Hello World will print after 5 seconds...");
//call the sleep method  of the Thread class
Thread.sleep(5000);
System.out.println("Hello World");
}
}

Just don't forget to put the throws Exception to the calling method.

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Java Timeout Or get search suggestion and latest updates.


Tagged: