Java之线程(继承)

来源:互联网 发布:徐州淘宝产品摄影 编辑:程序博客网 时间:2024/06/16 20:51

<span style="font-size:32px;">/** * @author cjm727649353 */public class Client1 {  public static void main(String[] args) {MyThread1 t1= new MyThread1(1);t1.start();MyThread1 t2 = new MyThread1(2);t2.start();}}</span>


<span style="font-size:32px;">class MyThread1 extends Thread{        private int first;                public MyThread1(int first) {            this.first = first;        }                public void run(){        for(int i=first;i<=100;i+=2){        System.out.print(i+" ");        }        System.out.println();        }}</span>





1 0
原创粉丝点击