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

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Ïê½â

 
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......

javaʹÓÃrocksawºÍvserv tcpipʵÏÖ»ùÓÚICMPµÄPing¹¦ÄÜ

Ò»£º×¼±¸ 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 ͨѶµÄ´úÂëÀý×Ó

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", ......

JavaÅàѵ,ÎÒΪʲôѡÔñ´«ÖDz¥¿Í

       ´ó¼ÒºÃ,ÎÒÊÇ´«ÖDz¥¿Í2009Äê12ÔÂ20ºÅ³å´Ì°àѧԱ.ÔÚ½ÓÏÂÀ´µÄ¼¸¸öÔÂÀïÎÒ½«ÕæʵµÄ¼Í¼ÔÚ´«ÖDz¥¿ÍµÄѧϰ¾­Àú.Ò»ÊǶÔ×Ô¼ºÑ§Ï°µÄ×ܽáºÍ¼Í¼;¶þÊÇÕæʵµÄ·´Ó¦ÔÚ´«ÖDz¥¿Íѧϰ¾­ÀúºÍ¹ý³Ì.
       ÏȽéÉÜÒ»ÏÂÎÒ×Ô¼º´Ó±ÏÒµµ½´«ÖDz¥¿Í֮ǰÔÚ±±¾©µÄ¾­Àú.09Äê±¾¿ ......

java×Ö·û´®×ª»»³ÉÈÕÆÚ

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 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ