12345678910111213141516171819 |
- public class TestRunnable {
- public static void main(String[] args) {
- MyRunnable runnable = new MyRunnable();
- Thread thread = new Thread(runnable);
- thread.start();
- }
- }
- class MyRunnable implements Runnable {
- @Override
- public void run() {
- try {
- Thread.sleep(1000);
- } catch (Exception e) {
- e.printStackTrace();
- }
- System.out.println("Finished.");
- }
- }
|