2016521-Java-Eighth Week Learning Summary

Textbook Knowledge Points

  • start()
  • run() defines the operation performed after the thread object is scheduled -
    sleep(int millsecond), the sleep method must be called in the try-catch block
  • saliva()

thread synchronization

thread union

There are three ways to create a thread, they are:

  • Inherit the Thread class to create a thread. If you want to get the current thread object in the program, you can use the method: Thread.currentThread(); if you want to return the name of the thread, you can use the method: getName();
  • Implement the Runnable interface to create a thread
  • Create Threads with Callable and Future

Code cloud link
Code cloud upload successful screenshot

Code hosting screenshot:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324646878&siteId=291194637