Question: Beginning with Java 7. What method do you override to provide the code thats executed by a thread? a. exec c. run b. start d.
Beginning with Java
7. What method do you override to provide the code thats executed by a thread?
| a. | exec | c. | run |
| b. | start | d. | task |
8. Consider the following program:
public class CountDownApp { public static void main(String[] args) { Thread t1 = new CountDown(); Thread t2 = new CountDown(); t1.start(); t2.start(); } }
Assuming that the CountDown class extends the Thread class, how many threads are used to run this program?
| a. | 1 | c. | 3 |
| b. | 2 | d. | 4 |
9. How long will a thread that executes the following statement sleep?
Thread.sleep(50);
| a. | exactly 50 milliseconds | c. | at least 50 milliseconds |
| b. | at most 50 milliseconds | d. | none of the above |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
