java ÍøÂç±à³Ì
ÕâÀï¶ÔÓÚ¼¸¸ö»ù±¾µÄ¸ÅÄî URL TCP UDP Socket ¾Í²»¼Ó˵Ã÷ÁË£¬ÕâÀï½ö½öÊǼǼһЩѧϰÈÕÖ¾±¸Íü¡£
1£ºÈçºÎ¶¨ÒåÏà¶Ô×ÊÔ´
¼ÙÉèÓÐÈçÏÂÁ½¸ö×ÊÔ´ £º
http://www.gamelan.com/pages/Gamelan.game.html
http://www.gamelan.com/pages/Gamelan.net.html
ÎÒÃÇ¿ÉÒÔͨ¹ýURL µÄ¹¹Ô캯ÊýÀ´¶¨Òå×ÊÔ´£¬¿ÉÒÔͨ¹ýÒ»¸ö URL ¶ÔÏóÀ´¹¹ÔìÒ»¸öÏ൱×ÊÔ´ URL(URL baseURL, String relativeURL)
£¬ÈçÏ£º
URL gamelan = new URL("http://www.gamelan.com/pages/");
URL gamelanGames = new URL(gamelan, "Gamelan.game.html");
URL gamelanNetwork = new URL(gamelan, "Gamelan.net.html");
¶ÔÓÚÓÐÌØÊâ×Ö·ûµÄ url µØÖ· È磺http://foo.com/hello world/ º¬Óпոñ£¬
ÄÇôÕâÀïµÄµØÖ·ÊÇÐèÒª encode µÄ£¨URL url = new URL("http://foo.com/hello%20world");£©£¬
»òÕßÊÇͨ¹ýuri À´Éú²ú url¡£ÈçÏ£º
URI uri = new URI("http", "foo.com", "/hello world/", "");
URL url = uri.toURL();
2£º Socket ¾ÍÊÇÒ»¸öµã¶ÔµãµÄ tcp Á¬½Ó£¬·þÎñ¶Ëͨ¹ýÒ»¸ö serversocket À´¼àÌý±¾µØµÄÒ»¸ö¶Ë¿Ú sport1£¬Èç¹ûÓпͻ§¶Ësocket Á¬½ÓÉÏÀ´£¬
serversocket »áÖØÐÂÉú³ÉÒ»¸ö socket £¬Õâ¸ösocket Á¬½Ó±¾»úµÄ¶Ë¿Ú sport1 ºÍ ¿Í»§¶Ësocket µÄ¶Ë¿Ú¡£
¿Í»§¶ËÁ¬½Ó·þÎñÆ÷µÄʱºò£¬»áÁ¬½Ó·þÎñÆ÷µÄ¼àÌý¶Ë¿Ú£¬¶ø¿Í»§¶ËΪÁËÄܹ»Ê¹µÃ·þÎñ¶ËÄܹ»Á¬½Óµ½¿Í»§¶Ë£¬¿Í»§¶ËsocketÒ²»á°ó¶¨Ò»¸ö±¾µØ¶Ë¿Ú£¬
Õâ¸ö¶Ë¿ÚÒ»°ãÀ´Ëµ¶¼ÊÇϵͳ·ÖÅäµÄ£¬¶øÇÒ·þÎñ¶ËµÄÉú³ÉµÄ socket Ò²»áÁ¬½ÓÕâ¸ö¿Í»§¶Ë»úÆ÷µÄϵͳ·ÖÅäµÄ¶Ë¿ÚÀ´½¨Á¢Á¬½Ó¡£
ÕâÀïµÄ ·þÎñ¶Ë serversocket ÔÚ¼àÌýµ½¿Í»§¶ËsocketÁ¬½Óºó Éú³ÉÒ»¸ö ·þÎñ¶ËµÄÁ¬½Ó¿Í»§¶ËµÄsocket£¬
ÕâÀïÕë¶Ôÿ¸öÁ¬½ÓÉú³ÉµÄsocketÀ´²úÉúÒ»¸öÏ̴߳¦ÀíÒµÎñµÄ»°£¬ÄÇôÕâ¸ö server ¾Í¿ÉÒÔÖ§³Ö¶à¸ö¿Í»§¶ËÁË¡£
3: UDP ÊDzÉÓÃÊý¾Ý°üµÄÐÎʽ·¢ËÍ¡£ÓкܶàµÄ·À»ðǽºÍ ·ÓÉÆ÷ÅäÖÃÓв»½ÓÊÜUDPÊý¾Ý°ü£¬Èç¹û³öÏÖÁ¬½Ó²»ÉÏ·þÎñÆ÷£¬»òÕß˵·þÎñ¶Ë½ÓÊÕ²»µ½ UDPÊý¾Ý°ü£¬ÅŲéÍøÂçµÄʱºò¿ÉÒÔºËʵһÏÂÕâ¸öÍøÂçÅäÖá£
UDP Êý¾Ý°üÊÇÒ»¸ö×ÔÑ°Ö·µÄÊý¾Ý°ü£¬Ëû°üº¬ÓÐÒªµ½´ïµÄÄ¿µÄµØÐÅÏ¢£¬Æäµ½´ïµÄʱ¼äºÍ˳ÐòºÍÄÚÈÝÊDz»±»±£Ö¤µÄ¡£Ëü²»ÏñTCPÄÇÑùÊǽ¨Á¢Ò»¸ö¿É¿¿µÄÁ´Â·Í¨µÀ´«Ê
Ïà¹ØÎĵµ£º
¶¨Ò壺
GOF¡¶Éè¼Æģʽ¡·Öиø״̬ģʽϵĶ¨ÒåΪ£ºÔÊÐíÒ»¸ö¶ÔÏóÔÚÆäÄÚ²¿×´Ì¬¸Ä±äʱ¸Ä±äËüµÄÐÐΪ¡£
ÏÈ¿´Ò»¸öÀý×Ó£º
package com.state;
public class KissingPrincess {
// ±ê־룬±êÖ¾ÊÇÇàÍÜ»¹ÊÇÍõ×Ó¡£
private boolean isFrog = true;
// ¸ù¾ÝisFrog½øÐв»Í¬µÄ²Ù×÷¡£
public void greet() {
if (isFrog)
......
Reflection ÊÇ Java ³ÌÐò¿ª·¢ÓïÑÔµÄÌØÕ÷Ö®Ò»£¬ËüÔÊÐíÔËÐÐÖÐµÄ Java ³ÌÐò¶Ô×ÔÉí½øÐмì²é£¬»òÕß˵“×ÔÉ󔣬²¢ÄÜÖ±½Ó²Ù×÷³ÌÐòµÄÄÚ²¿ÊôÐÔ¡£ÀýÈ磬ʹÓÃËüÄÜ»ñµÃ Java ÀàÖи÷³ÉÔ±µÄÃû³Æ²¢ÏÔʾ³öÀ´¡£
Java µÄÕâÒ»ÄÜÁ¦ÔÚʵ¼ÊÓ¦ÓÃÖÐÒ²ÐíÓõò»ÊǺܶ࣬µ«ÊÇÔÚÆäËüµÄ³ÌÐòÉè¼ÆÓïÑÔÖиù±¾¾Í²»´æÔÚÕâÒ»ÌØÐÔ¡£ÀýÈ磬Pascal¡¢C ......
Ê×ÏÈ£¬´ò¿ªMySQL Query Browser£¬ÔÚµ±Ç°TestÊý¾Ý¿âÏ£¬Ð½¨Ò»¸östudent±í£¬ÓÐÈçÏÂÊôÐÔ£º
create table student (name varchar(10),id int(2),sex varchar(10));
³ÌÐò¼ûÏ£º
package com.JDBC;
import java.sql.*;
public class JDBCTest {
public static void main(String[] args) {String driver = "com.mys ......
¶ÔÓÚÒ»¸öʵÏÖÁËComparable½Ó¿ÚµÄ¶ÔÏ󣬸ýӿÚÖ»ÄÜʵÏÖÒ»´Î¡£Èç¹ûÔÚÒ»¸ö¼¯ºÏÀïÃæÐèҪʹÓÃidÅÅÐò£¬¶øÔÚÁíÍâÒ»¸ö¼¯ºÏÀïÐèÒª°´Ãû×ÖÅÅÐòÕâʱ¾ÍÐèÒªÔÚÕâ¸ö¼¯ºÏÀïÃæÖ¸¶¨±È½ÏÆ÷¡£
Comparable½Ó¿ÚÉùÃ÷ÁËcompareTo(Object o)·½·¨
Comparator ½Ó¿ÚÉùÃ÷ÁËcompare(Object o1,Object o2)·½·¨
eg:
µÚÒ»¸öÊ÷¼¯ÊÇ°´ÕÕ¶ÔÏóĬÈϵÄidÅÅÐò£¬µ ......
ʹÓà Java communications API ʵÏÖ²¢Ðж˿ڴòÓ¡
ÕâÊÇÒ»¸öÔÚ¿Í»§Ö§³ÖÖÐÓöµ½µÄÐÂÎÊÌ⣬ÎÒÔÚÏà¹ØµÄÍøÕ¾([url]www.rxtx.org[/url] and [url]www.sun.com.cn[/url])ÉÏÕÒµ½ÁËһЩÓÐÓõÄÐÅÏ¢£¬×îºóÖÕÓÚÔÚWindows XP ºÍ LinuxIA32 ƽ̨ÏÂʵÏÖ²¢Ðж˿ڴòÓ¡ÕâÒ»¹¦ÄÜ¡£
Ê×ÏÈ£¬ÎÒÃÇÒª´ÓSUNµÄÍøÕ¾ÏÂÔØJava communicat ......