Home > Back-end >  Create a new thread, the main thread and new thread each perform 20 times, perform a new thread ever
Create a new thread, the main thread and new thread each perform 20 times, perform a new thread ever

Time:10-09

1. Create a new thread, the main thread and new thread each perform 20 times,
A new thread to do this every second, the main thread once every two seconds to perform

2. Use the Runnable interface in the form of an anonymous inner class to create two new threads, an output 20 times Hello, an output 20 times world

Strives for the code to solve

CodePudding user response:

You learn this is too forward or backward, create threads, thread used inside loop
  • Related