java-thread
package com.pacoson.mythread; public class NumberRunnable implements Runnable { private int first; public NumberRunnable(int first) { this.first = first; } public NumberRunnable(){ this(0); } public void run() { System.out.println(); for (int i = first; i < 50; i += 2) { System.out.println(i + " "); System.out.println("结束!"); } } public static void main(String[] args) { NumberRunnable odd = new NumberRunnable(1);// 创建线程对象 Thread thread_odd = new Thread(odd, "奇数线程"); thread_odd.start(); // 启动线程对象 new Thread(new NumberRunnable(2),"偶数线程").start(); } }