java基础知识 多线程
package org.base.practise9; import org.junit.Test; import java.awt.event.WindowAdapter; /** //1,线程有四种状态,新建,运行,中断,死亡 Thread left = new Hand("左手"); left.start(); for(int i=1;i<=10;i++){ // left.setPriority(); } Buyer buyer=new Buyer(); // Thread t=new Thread(new Gxy());
People people=new People(); people.getTeacher().start(); @Test People people=new People(); people.getTeacher().start(); } @Test Worker worker=new Worker(); } |
package org.base.practise9; /** Thread zhang=new Thread(this); TicketSeller ticketSeller=new TicketSeller(); public Thread getZhang() { public Thread getLi() { public Thread getZhao() { public Buyer() } |
package org.base.practise9; /** float n=0,zhen=0,fan=0,li=0; try { } |
||
package org.base.practise9; /** public Hand(String name) { @Override print(); } private synchronized void print() { |
||
package org.base.practise9; import java.awt.*; /** Color c; public MyCanvas(Color c) { |
||
package org.base.practise9; import java.awt.*; /** Thread red, blue; public MyFrame() { setLayout(null); red.start(); } } else if (thread == blue) { |
||
package org.base.practise9; /** Thread student2=new Thread(this); Thread teacher=new Thread(this); public Thread getStudent1() { public Thread getStudent2() { public Thread getTeacher() { @Override
|
通过练习,熟悉了线程的基本操作和概念,温故而知新。