package com.bj.thread; public class Runnable_implement{ public static void main(String[] args) { // TODO Auto-generated method stub //´´½¨Ò»¸öÏß³Ì Dog d=new Dog(); Thread t=new Thread(d); //ÔËÐÐÏß³Ì t.start(); } } class Dog implements Runnable { //ÖØÐ´run public void run(){ int times=0; while(true){ try { //ÐÝÃߣ¬µ¥Î»ºÁÃë,ʹÏ߳̽øÈëµ½Blocked״̬ Thread.sleep(1000); System.out.println("Dog :"+times); times++; } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(times==10){ break; } } } }