File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package ThreadDemo ;
2+
3+ /**
4+ * @author:Gerry
5+ * @description:
6+ * @date: Created in 2018/12/20
7+ */
8+ public class MyRunnable implements Runnable {
9+ @ Override
10+ public void run ()
11+ {
12+ System .out .println ("MyRunnable" );
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ package ThreadDemo ;
2+
3+ /**
4+ * @author:Gerry
5+ * @description:
6+ * @date: Created in 2018/12/20
7+ */
8+ public class MyThread extends Thread {
9+ @ Override
10+ public void run ()
11+ {
12+ super .run ();
13+ System .out .println ("MyThread" );
14+ }
15+ }
Original file line number Diff line number Diff line change 1+ package ThreadDemo ;
2+
3+ /**
4+ * @author:Gerry
5+ * @description:
6+ * @date: Created in 2018/12/20
7+ */
8+ public class Run {
9+ public static void main (String [] args ) {
10+ MyThread myThread =new MyThread ();
11+ myThread .start ();
12+ System .out .println ("MyThread运行结束!" );
13+
14+ MyRunnable runnable = new MyRunnable ();
15+ Thread thread = new Thread (runnable );
16+ thread .start ();
17+ System .out .println ("MyRunnable运行结束" );
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments