站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Java Tutorial 5.0 英文版

Implementing a Thread - Java Tutorial 5.0 英文版

The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Trail: Essential Java Classes
Lesson: Threads: Doing Two or More Tasks at Once

Implementing a Thread

If a Timer or another high-level API isn't sufficient, you might need to implement your own threads. This section tells you how to do so by customizing a thread's run method.

The run method gives a thread something to do. Its code implements the thread's running behavior. A thread's run method can do anything that can be encoded in statements: compute a list of prime numbers, sort some data, perform some animation.

The Thread class implements a standard thread, which, by default, does nothing. The two sections that follow discuss techniques for providing a run method for a thread:


Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.