»ñµÃµ±Ç°¼ÆËã»úÈ«²¿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Ïê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
Îļþ¶ÔÏóµÄÉú³ÉºÍÎļþµÄ´´½¨
/*
* ProcessFileName.java
*
* Created on 2006Äê8ÔÂ22ÈÕ, ÏÂÎç3:10
*
* Îļþ¶ÔÏóµÄÉú³ÉºÍÎļþµÄ´´½¨
*/
package study.iostudy;
import java.io.*;
public class GenerateFile
{
public static void main(String ......
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ÐͱäÁ¿µÄÖµ²»°üÀ¨ÔÚ´®Ðл¯µÄ±íʾÖУ¬È»¶ø·ÇtransientÐ͵ıäÁ¿ÊDZ»°üÀ¨½øÈ¥µÄ
¡¡¡¡Java´úÂë
¡¡¡¡class A implements Serializable {
¡¡¡¡private String name;
¡¡¡¡transient private String address;
¡¡¡¡}
¡¡¡¡ÄÇÃ´Ä ......
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 ......