正在加载图片...
实现Runnable接口创建线程 /Custom thread class /client class public class CustomThread public class client implements Runnable public someMethod ( public CustomThread(.) { /Create an instance of CustomThread CustomThread customThread new CustomThread(.); /Implement the run method in Runnable public void run() //Create a thread Thread thread new Thread(customThread); /Tell system how to run custom thread /Start a thread thread.start(); ©2006计算机系杨群 All rights lefts reserved.©2006 计算机系 杨厚群 All rights & lefts reserved. 实现Runnable接口创建线程 // Custom thread class public class CustomThread implements Runnable { . public CustomThread(.) { . } // Implement the run method in Runnable public void run() { // Tell system how to run custom thread . } . } // Client class public class Client { . public someMethod() { . // Create an instance of CustomThread CustomThread customThread = new CustomThread(.); // Create a thread Thread thread = new Thread(customThread); // Start a thread thread.start(); . } . }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有