JAVA »ñµÃIPµØÖ·
1. java »ñÈ¡ipµØÖ·µÄ´úÂë
String loacalIp = "";
try
{
InetAddress localhost = InetAddress.getLocalHost();
loacalIp =localhost.getHostAddress();
//System.out.println("localhost: "+localhost.getHostAddress());
//System.out.println("localhost: "+localhost.getHostName());
}
catch(UnknownHostException uhe)
{
System.err.println("Localhost Ip exception " + uhe.toString());
}
A£º´Ë´úÂëÔÚwindows ÏÂÃæ»ñÈ¡ipµØÖ·ÊÇÍêÈ«ÕýÈ·¡£
B£º´Ë´úÂëÔÚlinuxÏÂÃæÈ¡µÃµÄipµØÖ·×ÜÊÇ:127.0.0.1
2.ΪÁË»ñÈ¡linuxÏÂÃæÕýÈ·µÄipµØÖ·
ÐÞ¸ÄetcÏÂÃæµÄhostsÎļþ
***.***.***.*** localhost.localdomain localhost
ÐÞ¸ÄΪ±¾»úµÄipµØÖ·£¬¶ø²»ÊÇ127.0.0.1
¾ßÌåÐ޸ĵķ½·¨£¬µ±È»ÊÇÓÃvi½øÐб༡£±£´æºó²»ÓÃÖØÆô»úÆ÷£¬¼´¿É¡£
Ïà¹ØÎĵµ£º
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
public class Test {
public static void main(String args[]) {
int i;
int j;
for (i = 1; i <= 9; i++) {
for (j = 1; j <= i; j++) {
if (j * i <= 9)
System.out.print(j ......
Ò»¡¢JDBCµ÷Óô洢¹ý³Ì
creat proc proc_select
¡¡¡¡@pid varchar(20)
¡¡¡¡@address varchar(20) output
¡¡¡¡as
¡¡¡¡select @address=address from userinfo where pid=@pid
¡¡¡¡go
¡¡¡¡ÓÃjavaµ÷ÓÃ:
¡¡¡¡class.forName(\"sun.jdbc.odbc.JdbcOdbcDriver\"); //¼ÓÔØÇý¶¯
¡¡¡¡Connection con=DriverManager.ge ......
ת×ÔInfoQ£¬×÷Õß Charles Humble ÒëÕß ÕÅÁú
±¾ÔÂ3ÈÕSunµÄJ2SE 5.0ʵÏÖÒÑÖÕ½á·þÎñÖÜÆÚ£¨End of Service Life£¬¼´EOSL£©£¬ÕâÒ»ÌìÒ²ÊÇ×îºóµÄÒ»´Î5.0¸üз¢²¼ÈÕÆÚ£¨J2SE 5.0 Update 22£©¡£Ñ°ÇóSunÖ§³ÖµÄÓû§¿ÉÒÔÑ¡ÔñÉý¼¶µ½Java 6»òÊǶ©ÔÄSunµÄJava for Business³ÌÐò¡£
SunÌṩÁ˶àÖÖ¶àÑùµÄJava¸¶·ÑÖ§³Ö¡£Java¾µäÖ§³Ö£ ......