Java OCA OCP Practice Question 1293

Question

To create a custom thread class by extending java.lang.Thread.

Which of the following must you do?

  • A. Declare that your class implements java.lang.Runnable.
  • B. Override run().
  • C. Override start().
  • D. Make sure that all access to all data is via synchronized methods.


B.

Note

Your class should provide a run() method to implement the desired functionality.

There is no need to declare that it implements Runnable.

Overriding start() is not a good idea.

You need to provide synchronized access to data only if that data might be corrupted by other threads.




PreviousNext

Related