Java Threads - Tutorial

Share Embed Donate


Short Description

Download Java Threads - Tutorial...

Description

Threads in Programming Languages !

Introduction to Java threads

"

!

ICS491 - Spring 2007 Concurrent and High-Performance Programming

Several programming languages have provided constructs/abstractions for writing concurrent programs Java does it like it does everything else, by providing a Thread class "

! !

Modula, Ada, etc.

Note that in this class we use J2SE 1.5.0

You create a thread object Then you can start the thread

Henri Casanova ([email protected])

Extending the Thread class !

To create a thread, you can extend the thread class and override its “run()” method class MyThread extends Thread { public void run() { ... } ... } myThread t = new MyThread();

Example public class MyThread extends Thread { public void run() { for (int i=0; i
View more...

Comments

Copyright ©2017 KUPDF Inc.