JavaÏ̵߳Äͬ²½
Ò»¡¢Í¬²½ÎÊÌâÌá³ö
Ï̵߳Äͬ²½ÊÇΪÁË·ÀÖ¹¶à¸öÏ̷߳ÃÎÊÒ»¸öÊý¾Ý¶ÔÏóʱ£¬¶ÔÊý¾ÝÔì³ÉµÄÆÆ»µ¡£
ÀýÈ磺Á½¸öÏß³ÌThreadA¡¢ThreadB¶¼²Ù×÷ͬһ¸ö¶ÔÏóFoo¶ÔÏ󣬲¢ÐÞ¸ÄFoo¶ÔÏóÉϵÄÊý¾Ý¡£
public class Foo {
private int x = 100;
public int getX() {
return x;
}
public int fix(int y) {
x = x - y;
return x;
}
}
public class MyRunnable implements Runnable {
private Foo foo = new Foo();
public static void main(String[] args) {
MyRunnable r = new MyRunnable();
Thread ta = new Thread(r, "Thread-A");
Thread tb = new Thread(r, "Thread-B");
ta.start();
tb.start();
}
public void run() {
for (int i = 0; i < 3; i++) {
this.fix(30);
try {
Thread.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentTh
Ïà¹ØÎĵµ£º
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
Ò»£º×¼±¸ www.savarese.org download
1. rocksaw-1.0.0-src.tar.gz
2. vserv-tcpip-0.9.2-src.tar.gz
¶þ£º±àÒëÔ´ÎļþµÃµ½jar°ü ʹÓÃAnt
1. build vserv-tcpip-0.9.2-src
ÔÚvserv-tcpip-0.9.2Ŀ¼ÏÂÃ潨һ¸ötestsĿ¼£¬È»ºóÔÚcmd´°¿ÚϽøÈë ......
java Socket ͨѶµÄ´úÂëÀý×Ó
ʵÏÖClient¶Ë¹¦ÄܵÄClientApp.javaÔÎļþ£º
import java.net.*;
import java.io.*;
import java.lang.*;
public class ClientApp
{
public static void main(String args[])
{
try
{
//´´½¨Í¨Ñ¶²¢ÇÒºÍÖ÷»úRockÁ¬½Ó
Socket cSocket=new Socket("192.168.100.188", ......
´ó¼ÒºÃ,ÎÒÊÇ´«ÖDz¥¿Í2009Äê12ÔÂ20ºÅ³å´Ì°àѧԱ.ÔÚ½ÓÏÂÀ´µÄ¼¸¸öÔÂÀïÎÒ½«ÕæʵµÄ¼Í¼ÔÚ´«ÖDz¥¿ÍµÄѧϰ¾Àú.Ò»ÊǶÔ×Ô¼ºÑ§Ï°µÄ×ܽáºÍ¼Í¼;¶þÊÇÕæʵµÄ·´Ó¦ÔÚ´«ÖDz¥¿Íѧϰ¾ÀúºÍ¹ý³Ì.
ÏȽéÉÜÒ»ÏÂÎÒ×Ô¼º´Ó±ÏÒµµ½´«ÖDz¥¿Í֮ǰÔÚ±±¾©µÄ¾Àú.09Äê±¾¿ ......
package com.gaosheng.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class StringToDate {
/**
* ×Ö·û´®×ª»»³ÉÈÕÆÚ
* @param stringdate Ҫת»»µÄ×Ö·û´®(×Ö·û´®¸ñʽ yyyy-MM-dd)
* @return
*/
public Date getStringtoDate(Strin ......