ah there is nothing missing I made a mistake there. I am finding this way too difficult to grasp so I am going to focus on using synchronisation with monitors instead. Thanks for the help!
Type: Posts; User: bassie
ah there is nothing missing I made a mistake there. I am finding this way too difficult to grasp so I am going to focus on using synchronisation with monitors instead. Thanks for the help!
So I edited run() to help me try and trace what the program is doing at each step;
public void run()
{
System.out.println("Begin of run("+num+")");
for (int k=0; k<2000000; k++)...
Thanks for the advice norm, but this actually looks hopeless. The numbers are printed out in random order regardless of how they are ordered in the main method or what priority I set them, if I am...
so it turns out I was looking at it wrong, the code is slightly different (this book is really confusing), but the revised version still doesn't work.
The textbook claims it will print out...
Do you mean the currentThread method? I don't understand how I am meant to be using it...
Should I some how be referencing the run () method from NumberPrinter.java in the main() method of...
Thanks!
I looked it up and it appears that the setPriority method is defined in the Thread class.
I tried calling it using Thread.sePriority() but got an error for trying to call a non-static...
Well the book seems so be suggesting that setPriority() is part of the interface Runnable, or at least that I can use it in this situation by simply calling it. Am I misunderstanding this entirely?
Hi whenever I try to run Numbers.java I get;
NumberPrinter.java:8: error: cannot find symbol
setPriority(n);
^
...