1234567891011121314151617181920212223242526272829 |
- package com.sf.thread_new;
- public class TestThread extends Thread{
- public TestThread(){}
- public TestThread(String name){
-
-
- super(name);
- }
- @Override
- public void run() {
-
- System.out.println(getName() + " is running");
- }
- public static void main(String[] args) {
-
- System.out.println(Thread.currentThread().getName() + " is running");
-
- TestThread thread1 = new TestThread();
-
- thread1.start();
- TestThread thread2 = new TestThread("thread2");
- thread2.start();
- }
- }
|