赞
踩
- //继承继承继承Threadl类
- class MyThread extends Thread{
- public void run() {
- System.out.println("My thread is started.");
- }
- }
- MyThread myThread = new MyThread();
- myThread.start();
- //实现Runnable
- class MyRunnable implements Runnable{
- public void run() {
- System.out.println("My runnable is invoked.");
- }
- }
- Thread myThread = new Thread( new MyRunnable());
- myThread.start();
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。