running Threads-need HELP ps
hi all, i really need to submit this assignment and im at the point of banging my head on my PC coz java is making me run nuts.
i the code is working fine except that i need to run threads for any number of commands entered at input in the order in which thy're entered. i've written all commands in seperate classes and extended thread in each of them. all classes are working on a file so im calling them in my main class below. The for loop at the bottom of code is really giving me trouble. im sure i have to use if statements to run threads for commands entered. how can i do it. somebody help ps.
import java.io.*;
import java.util.*;
publicclass Command
{
publicstaticvoid main(String[] args)
{
Create cr =new Create();
cr.createFile();
//int numberOfCommands = // count how many commands there are on the line
String commandLine;
String s1 ="&;";
int numberofCommands;
System.out.print("Enter command: " );
try{
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
commandLine = br.readLine();
StringTokenizer st =new StringTokenizer(commandLine,"&;");
numberofCommands = st.countTokens();
System.out.println("Number of Commands = " + numberofCommands);
while (st.hasMoreTokens())
{
System.out.println(st.nextToken());
}
Thread t[] =new Thread[numberofCommands];
System.out.println("Threads created");
for (int i=0; i < numberofCommands; i++)
{
}
}catch (Exception e){}
}
}

