How to print the two sentence ??
Please help me
P.S. codes are for learning only
Campbell Ritchie wrote:What print functions? You do not have any functions in that code.
To call the methods of Listeners, you would need an event object which they are listening for. Why are you using listener interfaces of your own which the Java platform is not aware of?
For the Runnable, you would have to pass that to the constructor of a Thread and call the start method.
chuen abc wrote:
what do you mean by the start method?
Please see the api docs for the Thread class (that implements Runnable).
You could use the constructor:
public Thread(Runnable target)
It has a simple example on it, that leads up to the code:
PrimeRun p = new PrimeRun(143);
new Thread(p).start();
That way you would be able to print the statements in the run method.
chuen abc wrote:
I am so sorry that I cannot get it.
Dream p = new Dream();
new Thread(p).start();
I try the above codes ,but still cannot print the result.