See More

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