日期:2014-05-20 浏览次数:20968 次
public class Test {
public static void test(int i,int j){
/*
*这里是自己写的一些业务,做了一些逻辑操作,处理一些数据
*
/
System.out.println(i+j);
}
}
package com.keeya.test;
import keeya.util.*;
public class ThreadTest extends Thread {
public static int i = 0 , j = 0 ;
public void run() {
i++;
j++;
Test.test(i, j);
}
public static void main(String[] args) {
Thread thread1 = new ThreadTest();
Thread thread2 = new ThreadTest();
Thread thread3 = new ThreadTest();
Thread thread4 = new ThreadTest();
Thread thread5 = new ThreadTest();
Thread thread6 = new ThreadTest();
thread1.start();
thread2.start();
thread3.start();
thread4.start();
thread5.start();
thread6.start();
}
}
class Test {
public static void test(int i,int j){
MyOwnerPrint.println("This is {0} and i = {1}, j = {2}",Thread.currentThread(),i,j);
int temp = 100000000;
while(temp-- > 0);
MyOwnerPrint.println("This is {0} and i + j = {1}",Thread.currentThread(),i+j);
}
}
------解决方案--------------------