I have a error: ';' expected
issue with my Java code below. I don't know how to solve it?
SortThread
and MergeThread
have been created as a class, and compiled well.
The only problem is
SortThread t1.join() = new SortThread(a);
SortThread t2.join() = new SortThread(b);
MergeThread m.start() = new MergeThread(t1.get(),t2.get());
These three line codes has error: ';' expected
issues.
In this main, it will create two array, a and b. m array will merge a&b, and main will display m.
Any hints or solutions are very helpful for me.
import java.util.Random;
public class Main{
public static void main(String[] args){
Random r = new Random(System.currentTimeMillis());
int n = r.nextInt(101) + 50;
int[] a = new int[n];
for(int i = 0; i < n; i++)
a[i] = r.nextInt(100);
n = r.nextInt(101) + 50;
int[] b = new int[n];
for(int i = 0; i < n; i++)
b[i] = r.nextInt(100);
SortThread t1.join() = new SortThread(a);
SortThread t2.join() = new SortThread(b);
MergeThread m.start() = new MergeThread(t1.get(),t2.get());
System.out.println(Arrays.toString(m.get()));
}
}