ÓÃJAVAʵÏÖ¶àỊ̈߳¨Éú²úÕßÓëÏû·ÑÕßÎÊÌ⣩
public class MultiThread {
public static void main(String[] args) {
ProductStack box = new ProductStack("box");
Producer p1 = new Producer(box, "p1");
Producer p2 = new Producer(box, "p2");
Producer p3 = new Producer(box, "p3");
Consumer c1 = new Consumer(box, "c1");
Consumer c2 = new Consumer(box, "c2");
//Consumer c3=new Consumer(box,"c3");
//Consumer c4=new Consumer(box,"c4");
//Consumer c5=new Consumer(box,"c5");
p1.start();
p2.start();
p3.start();
c1.start();
c2.start();
//c3.start();
//c4.start();
// c5.start();
}
}
class Product {
int id;
public Product(int id) {
this.id = id;
}
public String toSring() {
return "Product" + id;
}
}
class ProductStack {
String name;
static int point = 0;
private Product[] p = new Product[10];
public ProductStack(String name) {
this.name = name;
}
public String getname() {
return name;
}
public synchronized int getpoint() {
return point;
}
public synchronized void push(Product a) {
while (point >= p.length) {
try {
this.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
this.notifyAll();
}
p[point] = a;
// System.out.println(point);
// System.out.println(p[point].toSring());
point++;
// yield();
}
private void yield() {
}
public synchronized Product pop() {
while (point == 0) {
try {
Ïà¹ØÎĵµ£º
Òë×¢
£º±¾ÎÄÀ´×Ôstraight_talking_java@yahoogroups.comÌÖÂÛ×飬ÒѾÊÇÒ»Äê¶àÇ°
µÄÎÄÕ¡£Alan WilliamsonÊÇJava Developers
JournalµÄ±à¼£¬ÏÂÎÄÀ´×ÔËûÔÚIBMµÄÒ»¸öÏûÏ¢À´Ô´¡£SWTºÍSwingµÄÂÛÕùÎÒ¼û¹ý²»ÉÙ£¬NetbeansºÍEclipseµÄҲͬÑù¶à¡£ÒëÕß·Òë
´ËÎIJ¢²»ÊÇÒª¼¤ÆðʲôÕùÖ´£¬Ò²²»ÊÇÖ§³ÖÄÄÒ»·½£¨ËäÈ»ÎÒµÄÈ·ÊÇÕ¾ÔÚSWTÒ»±ßµ ......
±¾ÎĽ²½âÁËJavaÐòÁл¯µÄ»úÖƺÍÔÀí¡£´ÓÎÄÖÐÄã¿ÉÒÔÁ˽âÈçºÎÐòÁл¯Ò»¸ö¶ÔÏó£¬Ê²Ã´Ê±ºòÐèÒªÐòÁл¯ÒÔ¼°JavaÐòÁл¯µÄËã·¨¡£
00 00 00 0B: 11, containVersionµÄÖµ.
0x70:TC_NULL£¬Ã»Óг¬ÀàÁË¡£
0x49: ÓòÀàÐÍ. 49 ´ú±í"I", Ò²¾ÍÊÇInt..
00 0E: ÓòÃû×Ö³¤¶ ......
l×é¼þ´Ó¹¦ÄÜÉÏ·Ö¿É·ÖΪ£º
1) ¶¥²ãÈÝÆ÷£ºJFrame,JApplet,JDialog,JWindow
2) ÖмäÈÝÆ÷£ºJPanel,JScrollPane,JSplitPane,JToolBar¡¡
3) ÌØÊâÈÝÆ÷£ºÔÚGUIÉÏÆðÌØÊâ×÷ÓõÄÖмä²ã£¬ÈçJInternalFrame,JLayeredPane,JRootPane.
1.JFrameµÄÓ÷¨
1) ÓÃgetContentPane( )·½·¨»ñµÃJFrameµÄ ......
Ê×ÏÈ,AMF3Ëƺõ²¢²»Ö§³ÖList.ArrayListµÈÊý×éµÄ½âÎö...Java¿Í»§¶Ë´«µÝList¶ÔÏó,AMF3ÎÞ·¨½âÎöΪArray...
ÔÒòÊÇ:AMF3Ö»Ö§³Ö»ù´¡Êý¾ÝÀàÐÍ...
¹Ê,ÐèÒª½«ListµÈÊý¾Ýת»»ÎªObject[] !ÕâÑùAMF3²ÅÄܽ«Java´«µÝµÄÊý×é½âÎöΪArray...
ÓÉÓÚÊý×éµÄ´´½¨,¼´±ãÒ»¿ªÊ¼²»¸³Öµ,Ò²ÐèÒªÉèÖÃÊý×éµÄlength,Èç:String[] myString = new Str ......
×î½ü°àÀïµÄͬѧ¶¼Ã¦×ű¨°à£¬Óиö´ïÄÚÊÇjavaÅàѵ£¬ÓиöÉîÀ¶ÊÇC++Åàѵ£¬ÍøÉÏ¿´ÁËЩÌû×Ó˵ʲôµÄ¶¼ÓУ¬×ÔÎҸоõÅàÑøÒ»¸öC++³ÌÐòÔ±µÄÖÜÆÚÒª±ÈÅàÑøÒ»¸öjAVA³ÌÐòÔ±µÄÖÜÆÚ³¤ºÜ¶à£¬µ±È»£¬C++ÒªÊÇѧµÄºÃµÄ»°¿Ï¶¨±ÈѧjavaµÄÅ££¬µ«ÊǸ¶³öµÄ´ú¼Û¸öÈËÈÏΪÊÇÓкܴó²î¾àµÄ¡£¶ÔÓÚÏÖÔÚÊг¡É϶ÔÓÚÓïÑÔµÄÐèÇóÒ² ......