当前位置:编程学习 > JAVA >>

java 问题

package com.qq.javatest;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2011</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */

public class JavaTest extends Thread {
    private int countDown = 5;
    private static int threadCount = 0;
    
    
    
    public JavaTest() {
        super("" + (++threadCount));
        start();
    }
    
    public String toString() { return "#" + getName() + ": " + countDown; }
    
    public void run() {
        while(true) {
            System.out.println(this);
            
            if(--countDown == 0) return;
            
            yield();
        }
    }
    
    
    
    public static void main(String[] args) {
        for(int i=0; i<5; i++) new JavaTest();
    }
}


如何实现逐步改变toString(),每次输出更长的字符串? --------------------编程问答--------------------
设置一个静态变量static的
补充:Java ,  Java相关
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,