As you may have guessed from me posting here I am new to java game programming.( I usually spend most of my time making Operation Flashpoint missions).
Anyway to the problem. I’m after making a threadpool using David Brackeens acclaimed book. However when I compile the .java file it says that the system.out.printIn has an unrecognised symbol and the “.” symol is highlighted.
Here’s what the console printed out.
ThreadPooltest.java:40 cannot resolve symbol
symbol : method printIn (java.lang.String)
location: class java.io.PrintStream
System.out.printIn("Task " + taskID + ": start");
If anybody can help it would be much appreciated.
Oh and here’s the actual threadpooltest code
public class ThreadPoolTest {
public static void main(String[] args) {
if (args.length != 2) {
System.out.printIn("Tests the ThreadPool task.");
System.out.printIn(
"Usage: java ThreadPoolTest numTasks numThreads");
System.out.printIn(
" numTasks - integer: number of tasks to run.");
System.out.printIn(
" numThreads - integer: number of threads " +
"in the thread pool.");
return;
}
int numTasks = Integer.parseInt(args[0]);
int numThreads = Integer.parseInt(args[1]);
//create the thread pool
ThreadPool ThreadPool = new ThreadPool (numThreads);
// run example tasks
for (int i=0; i<numTasks; i++) {
ThreadPool.runTask(createTask(i));
}
// closes the pool and wait for all tasks to finish
ThreadPool.join();
}
/**
Creates a simple Runnable that prints an ID, waits 500
milliseconds, then prints the ID again.
*/
private static Runnable createTask(final int taskID) {
return new Runnable() {
public void run() {
System.out.printIn("Task " + taskID + ": start");
// simulate a long running task
try {
Thread.sleep(500);
}
catch (InterruptedException ex) {}
System.out.printIn("Task " + taskID + ": end");
}
};
}
}
Thanks,
Hauk