java¶àÏ̶߳Áдͬһ¸öÎļþµÄ´úÂë
±¾ÎÄÌṩjava¶àÏ̷ֱ߳ð¶¨Ê±¶Áдͬһ¸öÎļþµÄÑùÀý£¬ÆäÖÐÁ½¸öỊ̈߳¬Ò»¸öÿ·ÖÖÓдÈ뵱ǰʱ¼äµ½Ö¸¶¨Îļþ£¬ÁíÒ»¸öÏ̶߳Á³öÿ·ÖÖÓÐÂдµÄÄÚÈÝ¡£
ʹÓüòµ¥µÄThread.sleep¼¼ÊõʵÏÖ¶¨Ê±
package test.thread;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.Date;
/**
* ¶àÏ̶߳Áдͬһ¸öÎļþµÄÑùÀý¡£
*/
public class ThreadReadWrite {
public static void main(String[] args) {
new ThreadWrite().start();
try {
Thread.sleep(2000); // ÐÝÃߣ¬ÒÔÃâÄÇÃæ»¹ÓÐдºÃ
} catch (InterruptedException e) {
e.printStackTrace();
}
new ThreadRead().start();
}
}
class ThreadWrite extends Thread {
File file = new File("test.txt");
@Override
public void run() {
try {
while (true) {
FileWriter out = new FileWriter(file, true);// ×·¼ÓдÈë
out.write(new Date() + "\n");
out.flush();
out.close();
Thread.sleep(3000); // ÎÒÕâÀï¼ä¸ô¸Ä³É3Ã룬·½±ã²âÊÔ
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
class ThreadRead extends Thread {
File file = new File("test.txt");
@Override
public void run() {
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
while (true) {
System.out.println(reader.readLine());
Thread.sleep(3000); // ÎÒÕâÀï¼ä¸ô¸Ä³É3
Ïà¹ØÎĵµ£º
1¡¢¿ØÖÆ"×Ý´ò"¡¢ ºá´ò”ºÍ“Ò³ÃæµÄ±ß¾à¡£
£¨1£©<script defer>
function SetPrintSettings() {
¡¡// -- advanced &n ......
Java³ÌÐòÔ±µÄÃÔʧ—ÂÛ“ÐéÄâ»ú”
2009Äê08Ô ×÷Õߣº¶«·½Ö©ÖëÒë
ÐéÄâ»ú¼¼ÊõÏÖÔڷdz£ÈÈÃÅ£¬ÈËÃÇÈÏΪËü¿ÉÒÔÍê³ÉÒ»ÇÐÊÂÇé¡£ÈËÃÇÈÈÖÔÓÚÈÃJVM¿ÉÒÔÔËÐÐRuby¡¢PHP»òÆäËüһЩÈÈÃÅÓïÑÔ£¬ÒÔ¼°Ö§³ÖÏñJava FXÖ®ÀàµÄ¼¼Êõ¡£ÕâÖÖÏÖÏóÊǺÃÊÇ»µ£¿Joe WinchesterÒÔ×Ô¼ºµÄ¾ÀúÀ´ÂÛÖ¤Á˶Դ˵Ŀ´·¨¡£
ÔÚJava³öÏÖ֮ǰÎÒ ......
Spring Framework ¡¾Java¿ªÔ´ J2EE¿ò¼Ü¡¿
SpringÊÇÒ»¸ö½â¾öÁËÐí¶àÔÚJ2EE¿ª·¢Öг£¼ûµÄÎÊÌâµÄÇ¿´ó¿ò¼Ü¡£ SpringÌṩÁ˹ÜÀíÒµÎñ¶ÔÏóµÄÒ»Ö·½·¨²¢ÇÒ¹ÄÀøÁË×¢Èë¶Ô½Ó¿Ú±à³Ì¶ø²»ÊǶÔÀà±à³ÌµÄÁ¼ºÃϰ¹ß¡£SpringµÄ¼Ü¹¹»ù´¡ÊÇ»ùÓÚʹÓÃJavaBeanÊôÐ﵀ Inversion of ControlÈÝÆ÷¡£È»¶ø£¬Õâ½ö½öÊÇÍêÕûͼ¾°ÖеÄÒ»²¿·Ö£ºSpringÔÚʹÓà ......
²»¹ÜÎÒÊǶàôϲ»¶JAVAµ«ÊÇ£¬´Óʵ¼Ê¿ª·¢½Ç¶È½²£¬JavaµÄ¶àÏß³ÌȷʵûÓÐC++ºÃʹ¡£
±íÏÖÔÚ£º
1.JavaûÓÐÈ«¾Ö±äÁ¿£»
2.Java µÄÏß³ÌÖ®¼äµÄͨÐűȽϲC++ÌṩÁ˶àÖÖͨÐÅ·½Ê½£»
3.JavaµÄÊý¾Ýͬ²½ÊÇͨ¹ýsynchronizedÀ´ÊµÏÖ£¬µ«ÊÇ»ù±¾ÉϵÈÓÚ½»¸øÁËÐéÄâ»úÀ´Íê³É£¬¶øC++ÓкܶàÖÖ£ºÁÙ½çÇø¡¢»¥³âÌåµÈ¡£
4. JavaµÄ¶àÏß³Ìrun·½· ......