1、继承Thread类,重写run()方法; 2、实现Runnable接口,重载Runnable接口中的run()方法; 使用2比较好,因为使用实现Runnable接口的方式创建的线程可以处理同一资源, 由此实现资源的共享。