This question is also from the mock exam
http://jquest.webjump.com. The correct answers are given as 'a' & 'b'. Is only 'b' not enough ? Please advise me.
What can you write at the comment //A in the following code so that this program writes the
word "running" to the standard output?
1. class RunTest implements Runnable {
2. public static void main(
String args[]) {
3. RunTest rt = new RunTest();
4.
Thread t = new Thread(rt);
5. //A
6. }
7. public void run() {
8. System.out.println("running");
9. }
10. void go() {
11. start(1);
12. }
13. void start(int i) {
14. }
15. }
Select all valid answers.
Ans :
a. System.out.println("running");
b. t.start();
c. rt.start();
d. rt.start(1);