---
title: "java 多线程的实现"
author: "leafca"
date: "2011-09-23T14:56:32Z"
tags: []
categories: ["编程语言"]
slug: "java"
draft: false
lastmod: "2011-09-23T14:56:32Z"
id: 1179032
url: "https://leafca.iteye.com/blog/1179032"
---

实现多线程的方式有两种：
   1 继承Thread类，重写run()方法,在run中编写执行主体
   2 实现runnable接口，实现他的run()方法,这种方法是优于第一种的嘛，当然了，java是单继承的，用了第一种方法这个线程类就无法继承其他类了，如果业务上需要继承其他类的话实现接口是最好不过的了。