java threads different streams
this code read numbers from different steam data , and outputs the whole sum. is there something wrong with this code ? how can i fix it ?



    public class thr extends Thread{
	static int numThr=100, sum=0;
	private int Num;
	private thr(int Num){this.Num =Num;}
	public void run() {
		int k = IntegerReader.get(Num);
		int count=0;
		while(k>0) {
			if(count%numThr==Num) sum+=k;
			count++;
			k=IntegerReader.get(Num);
		}
	}
	public static void main(String[] a) throws Exception {
		thr[] st =new thr[numThr];
		for(int i=0; i<numThr; i++) st[i] = new thr(i);
		for(int i=0; i<numThr; i++) st[i].start();
		System.out.println("sum = "+sum);
	}
    }

java threads different streams
===

this code read numbers from different steam data , and outputs the whole sum. is there something wrong with this code ? how can i fix it ?



    public class thr extends Thread{
	static int numThr=100, sum=0;
	private int Num;
	private thr(int Num){this.Num =Num;}
	public void run() {
		int k = IntegerReader.get(Num);
		int count=0;
		while(k>0) {
			if(count%numThr==Num) sum+=k;
			count++;
			k=IntegerReader.get(Num);
		}
	}
	public static void main(String[] a) throws Exception {
		thr[] st =new thr[numThr];
		for(int i=0; i<numThr; i++) st[i] = new thr(i);
		for(int i=0; i<numThr; i++) st[i].start();
		System.out.println("sum = "+sum);
	}
    }
