One of the most efficient programs is this one:

public
class LowOverhead
{
     public static void
     main(String[] args)
     {
         System.exit(0);
     }
}


Anyway, java.lang.Thread.sleep(...) is for programmed pauses in a thread's
activity that are determined only by a real-time duration.
Java.lang.Object.wait(...) is for synchronization between threads. They
serve entirely different purposes and offhand I can think of no situation
in which there'd be a choice between them for a given purpose.

Programming with threads is not trivial. Read up on it before embarking on
it for the first time. Sun has tutorials, of course:
<http://java.sun.com/docs/books/tutorial/essential/index.html>
<http://java.sun.com/docs/books/tutorial/essential/threads/>. The book
"Concurrent Programming in Java (2nd ed.)" by Doug Lea (Addison Wesley /
Sun Press / Java Series) is excellent, but advanced.

Randall Schulz
Mountain View, CA USA


At 08:21 2002-08-30, Sriram Narasimhan <[EMAIL PROTECTED]> wrote:
>Which is the most efficient way of programming ? Using wait() or sleep()

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to