Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java¶à線³ÌµÄ實Àý

import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.event.*;
public class ThreadDemo extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
public ThreadDemo() {
JButton btn = new JButton("Click me");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Thread thread1 = new Thread(new Runnable() {
public void run() {
Graphics g = getGraphics();
for (int i = 10; i < 300; i += 10) {
try {
Thread.sleep(100);
g.drawOval(i, 100, 10, 10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});

Thread thread2 = new Thread(new Runnable() {
public void run() {
Graphics g = getGraphics();
for (int i = 10; i < 300; i += 10) {
try {
Thread.sleep(500);
g.drawOval(i, 150, 15, 15);
g.draw3DRect(i, i, i, i, true);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});





thread1.start();
thread2.start();


}
});
getContentPane().add(btn, BorderLayout.NORTH);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setSize(320, 200);
setVisible(true);
}
public static void main(String[] args) {
new ThreadDemo();
}
}


Ïà¹ØÎĵµ£º

javaÊÂÎñ


ÊÂÎñ´¦Àí×ܽá
À´Ô´£ºhttp://space.itpub.net/13956325/viewspace-598381
Ò»¡¢Ê²Ã´ÊÇJava ÊÂÎñ
ͨ³£µÄ¹ÛÄîÈÏΪ£¬ÊÂÎñ½öÓëÊý¾Ý¿â Ïà¹Ø¡£
Ê Îñ±ØÐë·þ´ÓISO/IECËùÖÆ¶¨µÄACIDÔ­Ôò¡£ACIDÊÇÔ­×ÓÐÔ£¨atomicity£©¡¢Ò»ÖÂÐÔ£¨consistency£©¡¢¸ôÀëÐÔ £¨isolation£©ºÍ³Ö¾ÃÐÔ£¨durability£©µÄËõд¡£ÊÂÎñµÄÔ­×ÓÐÔ±íʾÊÂÎñ ......

ÀûÓÃLuceneËÑË÷JavaÔ´´úÂë

Ä³Ð©ÍøÕ¾ÔÊÐíÈí¼þ¿ª·¢ÉçÍÅͨ¹ý·¢²¼¿ª·¢ÕßÖ¸ÄÏ¡¢°×ƤÊé¡¢FAQs¡¾³£¼ûÎÊÌâ½â´ð¡¿ºÍÔ´´úÂëÒÔʵÏÖÐÅÏ¢µÄ¹²Ïí¡£Ëæ×ÅÐÅÏ¢Á¿µÄÔö³¤£¬ºÍ¼¸¸ö¿ª·¢Õß¹±Ï׳ö×Ô¼ºµÄ֪ʶ¿â£¬ÓÚÊÇÍøÕ¾ÌṩËÑË÷ÒýÇæÀ´ËÑË÷Õ¾µãÉÏÏÖÓеÄËùÓÐÐÅÏ¢¡£ËäÈ»ÕâЩËÑË÷ÒýÇæ¶ÔÎı¾ÎļþµÄËÑË÷¿ÉÒÔ×öµÄºÜºÃ£¬µ«¶Ô¿ª·¢ÕßËÑË÷Ô´´úÂë×öÁ˱ȽÏÑϸñµÄÏÞÖÆ¡£ËÑË÷ÒýÇæÈÏΪԴ´úÂë ......

Java Concurrent°üѧϰ֮ConcurrentHashMap

ÔÚJava concurrent°üÖÐÓÐÕâôһ¸ö½Ó¿Ú£ºConcurrentMap¡£
ConcurrentMap¼Ì³Ð×ÔMap£¬²¢Ìí¼ÓÁ˼¸¸öеÄÔ­×Ó·½·¨£º putIfAbsent¡¢remove¡¢replace
Æä·½·¨ÕªÒªÈçÏ£º
 V
putIfAbsent(K key, V value)
          Èç¹ûÖ¸¶¨¼üÒѾ­²»ÔÙÓëij¸öÖµÏà¹ØÁª£¬Ôò½ ......

3des¼ÓÃÜËã·¨µÄJavaʵÏÖ

import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
public class CipherTest {
public static void main(String[] args) {
try {
byte[] keydata = { (byte) 0x00, (byte) 0x01, (byte) 0x02,
(byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06, ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ