java 线程

it2022-05-05  136

java 线程 // extends 继承线程 public class cThread extends Thread { private int i = 1; //重写 run()方法, run()方法的方法体就是线程执行体 public void run(){ for( ; i < 100; i++){ System.out.println(getName() + " " + i); } } public static void main(String[] args){ //创建线程 new cThread().start(); new cThread().start(); } }

  

posted on 2016-08-02 16:50 苏清 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/YaChing/p/5729898.html


最新回复(0)