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

»ñµÃµ±Ç°¼ÆËã»úÈ«²¿IPµÄÒ»¸öjavaС³ÌÐò

import java.net.InetAddress;
//±¾³ÌÐòʵÏÖÁË»ñÈ¡±¾µØIPµØÖ·
public class IP {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
InetAddress localHost;
InetAddress []ip;
try{
localHost=InetAddress.getLocalHost();
ip=InetAddress.getLocalHost().getAllByName(localHost.getHostName());
for(int i=0;i<ip.length;i++)
System.out.println(ip[i].getHostName()+":"+ip[i].getHostAddress());
}catch(Exception ex){
ex.printStackTrace();
}
}
}


Ïà¹ØÎĵµ£º

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 IOѧϰ

Îļþ¶ÔÏóµÄÉú³ÉºÍÎļþµÄ´´½¨
 
/*
 * ProcessFileName.java
 *
 * Created on 2006Äê8ÔÂ22ÈÕ, ÏÂÎç3:10
 *
 * Îļþ¶ÔÏóµÄÉú³ÉºÍÎļþµÄ´´½¨
 */
package study.iostudy;
import java.io.*;
public class GenerateFile
{
    public static void main(String ......

javaÖе±Ç°Â·¾¶ Ïà¶Ô·¾¶

public class FilePath {
  public void Print() {
   String a = this.getClass().getClassLoader().getResource(".").getPath();
   String b = this.getClass().getResource("").getPath();
   String c = this.getClass().getResource(" ").getPath();
&n ......

javaÐÞÊηûÖ®transient¡¾×ªÌù¡¿

JavaÓïÑԵĹؼü×Ö£¬ÓÃÀ´±íʾһ¸öÓò²»ÊǸöÔÏó´®Ðл¯µÄÒ»²¿·Ö¡£µ±Ò»¸ö¶ÔÏó±»´®Ðл¯µÄʱºò£¬transientÐͱäÁ¿µÄÖµ²»°üÀ¨ÔÚ´®Ðл¯µÄ±íʾÖУ¬È»¶ø·ÇtransientÐ͵ıäÁ¿ÊDZ»°üÀ¨½øÈ¥µÄ
¡¡¡¡Java´úÂë
¡¡¡¡class A implements Serializable {
¡¡¡¡private String name;
¡¡¡¡transient private String address;
¡¡¡¡}
¡¡¡¡ÄÇÃ´Ä ......

javaÁ¬½Ó¸÷ÖÖÊý¾Ý¿â·½Ê½ËÙ²é±í

javaÁ¬½Ó¸÷ÖÖÊý¾Ý¿â·½Ê½ËÙ²é±í1£®Oracle8/8i/9iÊý¾Ý¿â£¨thinģʽ£©Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl"; //orclΪÊý¾Ý¿âµÄSID
String user="test";
String password="test";
Connection conn= DriverManager.getConnection(url,u ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ