Éú²úÕßÏû·ÑÕßÎÊÌâÖ®JavaÏß³ÌʵÏÖ
ÔÌùÄÚÈÝÇë¼û: http://topic.csdn.net/u/20100116/17/6a204504-9e70-435f-be55-f0630ed12fdf.html?seed=942806558&r=62778073#r_62778073
Çë´óÅ£Ö¸Õý.
²úÆ·Àà:
package selfimpr.producerCustomer;
/**
* ²úÆ·
* @author selfimpr
* @blog http://blog.csdn.net/lgg201
* @email lgg860911@yahoo.com.cn
*
*/
public class Product {
private int id;
private String name;
public Product(int id, String name) {
this.id = id;
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String toString() {
return "Product: {id: " + this.id + ", name: " + this.name + "};";
}
}
Éú²úÕßÀà:
package selfimpr.producerCustomer;
import java.util.List;
/**
* Éú²úÕßÏß³Ì, ½«databaseʵÏÖ
* @author selfimpr
* @blog http://blog.csdn.net/lgg201
* @email lgg860911@yahoo.com.cn
*
*/
public class Producer implements Runnable {
private List<Product> database;
private static int count = 0;
private int sn;
public Producer(int sn, List<Product> database) {
this.sn = sn;
this.database = database;
}
@Override
public void run() {
while (true) {
if (database.size() < 10) {
produce();
}
try {
Thread.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void produce() {
synchronized (database) {
Product product = new Product(count, "product_" + count++);
database.add(product);
System.out.println("Producer[" + this.sn + "] produce " + product);
}
}
}
Ïû·ÑÕßÀà:
package selfimpr.producerCustomer;
import java.util.List;
/**
* Ïû·ÑÕßÏß³Ì, ͬ²½database
* @author selfimpr
* @blog http://blog.csdn.net/lgg201
* @email lgg860911@yahoo.com.cn
*
*/
public class Customer implements Runnable {
private List<Product> database;
private int sn;
public Cus
Ïà¹ØÎĵµ£º
ͨ¹ýjava.awt.RobotµÄcreateScreenCapture½ØÆÁ¡£
public static void captureScreen(String fileName) throws Exception {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle screenRectangle = new Rectangle(screenSize);
& ......
JavaÐéÄâ»úµÄÄÚ²¿Ìåϵ½á¹¹Ò²ÐíºÜÉÙÓÐÈËÈ¥¹ØÐÄ£¬ÒòΪ¶ÔÓÚJava³ÌÐòÔ±À´Ëµ£¬Ò»°ãÖ»ÐèÒª¸úAPI´ò½»µÀ¾Í¿ÉÒÔÁË¡£ÕâЩÌåϵ½á¹¹Ö»ÊÇJavaÐéÄâ»úÄÚ²¿µÄ½á¹¹¶øÒÑ¡£µ«ÊÇÈç¹ûÀí½âÁËÆäÄÚ²¿½á¹¹£¬¶ÔÓÚÎÒÃÇ¿ª·¢ÏîÄ¿£¬ÒÔ¼°ÅųýϵͳÖеÄÏà¹Ø¹ÊÕÏÊÇÓÉ°ïÖúµÄ¡£
ÏÈ¿´¿´×ÜÌå½á¹¹Í¼£¬ÈçÏ£º
¸÷²¿·ÖµÄÖ÷Òª¹¦ÄÜ·Ö±ðÊÇ£º
1. Àà×°ÔØ×Óϵͳ:¸ºÔðJavaÀ ......
Java³£ÓÃ×Ö·û¼¯±àÂëÏê½â
Web¿ª·¢µÄʱºò¾³£»áÓöµ½Ò»Ð©×Ö·û±àÂëµÄ´íÎó£¬ÈçÒ³ÃæÂÒÂëµÈÎÊÌ⣬ËùÒÔÓбØÒªÐè¶Ô×Ö·û±àÂëÓÐËùÁ˽⣬ÒÔÏÂÊÇRickiÊÕ¼¯µÄһЩ×ÊÁÏ£¨¿ÉÄܲ»ÊǺÜÈ«£¬µ«Ï£Íû¶ÔÄãÓÐËù°ïÖú£©
Java±ê×¼×Ö·û¼¯£ºËùνJava±ê×¼×Ö·û¼¯£¬¾ÍÊÇJavaƽ̨֧³ÖµÄ×Ö·û ......
java³£ÓÃÀàµÄʹÓ÷½·¨
Interger£ºÕûÊýÀàÐÍ
£±¡¢ÊôÐÔ¡£
static int MAX_VALUE£º·µ»Ø×î´óµÄÕûÐÍÊý£»
static int MIN_VALUE£º·µ»Ø×îСµÄÕûÐÍÊý£»
static Class TYPE £º·µ»Øµ±Ç°ÀàÐÍ¡£
Àý×Ó£º
´úÂë:
System.out.println("Integer.MAX_VALUE: " + Integer.MAX_VALUE );
½á¹ûΪ£ºInteger.MAX_VALUE: 2147483647
&nb ......