[zhuangzai]javaÈÝÆ÷
JavaÈÝÆ÷ÀàѧϰÐĵÃ
ÓÉÓÚÎÒ¶ÔC++±È½ÏÊìϤ£¬ËùÒÔѧϰJavaÓ¦¸ÃÖصãÌå»áJava´øÀ´µÄиÅÄî¡£±¾ÎÄ»ù±¾ÉÏÊÇJava±ê×¼¿âÖм¯ºÏ¿ò¼ÜµÄ»ù±¾¸ÅÄûÓÐÀý×Ó¡£Ð´±¾ÎĵÄÄ¿µÄÔÚÓÚ·½±ãÎҺܳ¤Ê±¼äºóÈôÊÇÍüÁËÕâЩ¶«Î÷¿ÉÒÔͨ¹ýÕâƬÎÄÕÂѸËÙ»ØÒäÆðÀ´¡£
1. ½Ó¿Ú
Õû¸öJavaÈÝÆ÷ÀàµÄ»ù´¡ÊÇÈÝÆ÷½Ó¿Ú£¨ÀýÈçCollection£¬MapµÈ½Ó¿Ú£©£¬¶ø²»ÊÇÀࡣʹÓýӿڵÄ×î´óºÃ´¦ÔÚÓÚ½«ÈÝÆ÷µÄʵÏÖÓëÈÝÆ÷µÄ½Ó¿Ú·Ö¿ª£¬Õâ¾ÍÒâζ×ÅÄã¿ÉÒÔʹÓÃÏàͬµÄ·½·¨·ÃÎÊÈÝÆ÷¶ø²»ÓùØÐÄÈÝÆ÷ÊÇÓÉʲôÑùµÄÊý¾Ý½á¹¹ÊµÏֵġ£Í¬Ñù£¬Iterator½Ó¿ÚҲʹµÃÓû§¿ÉÒÔʹÓÃÏàͬµÄ·½·¨·ÃÎʲ»Í¬µÄÈÝÆ÷Àà¡£ÒÔÉÏÕâЩÊÇͨÓÃËã·¨µÄ»ù´¡¡£
1.1 Collection½Ó¿Ú
Collection½Ó¿ÚÓÐÈçÏ»ù±¾·½·¨£º
boolean add(Object obj)£ºÈç¹ûÌí¼Ó¶ÔÏóºó£¬¼¯ºÏȷʵ·¢ÉúÁ˱仯£¬Ôò·µ»Øtrue£»·ñÔò·µ»Øfalse
Iterator iterator()£º·µ»ØÒ»¸öʵÏÖÁËIterator½Ó¿ÚµÄ¶ÔÏó
´ËÍ⣬»¹ÓÐ
int size(),boolean isEmpty()£¬boolean contains(Object obj)£¬void clear()µÈÐí¶àÓÐÓõķ½·¨
1.2 Map½Ó¿Ú
MapÓÃÓÚ´æ·Å¹Ø¼ü×Ö/Öµ¶Ô¡£ÓÐÈçÏ»ù±¾·½·¨£º
Object get(Object key)
Object put(Object key,Object balue)
Set keySet()
Set entrySet()
´ËÍ⣬»¹ÓÐÆäËûÓÐÓõķ½·¨¡£
ÐèҪעÒâµÄÊÇ£¬´Ó±íÃæ¿´ËüËƺõ¾ÍÊÇÒ»ÖÖÓɼüÖµ¶Ô¹¹³ÉµÄ¼¯ºÏ£¬µ«Êµ¼ÊÉϲ¢²»ÊÇÕâÑù¡£²»¹ýÁíÒ»·½Ãæ¼ÙÈ罫MapµÄijһ²¿·Ö¿´×÷¼¯ºÏ£¬ÓÐʱºòÒ²»¹ÊÇÏԵ÷dz£·½±ãµÄ¡£»»ÑÔÖ®Äã¿ÉÒÔ´´½¨Ò»¸ö¼¯ºÏÓÃËüÀ´±í´ïMapµÄÄÇÒ»²¿·Ö¡£×ÛÉÏËùÊö£¬Ò»¸öMap¿ÉÒÔ·µ»ØµÄ¶«Î÷°üÀ¨ËüµÄ¼üÖµ¹¹³ÉµÄÒ»¸öSet¡¢ÓÉËüµÄÖµ¹¹³ÉµÄÒ»¸ö¼¯ºÏ»òÕßÓÉËüµÄ¼üÖµ¶Ô¹¹³ÉµÄÒ»¸öSet¡£
1.3 Iterator½Ó¿Ú
Iterator½Ó¿ÚÓÐÏÂÃæ3¸ö»ù±¾·½·¨£º
Object next()£º·µ»Øµü´úÆ÷¸ÕÔ½¹ýµÄÔªËصÄÒýÓÃ
boolean hasNext()£ºÅжÏÈÝÆ÷ÄÚÊÇ·ñ»¹Óпɹ©·ÃÎʵÄÔªËØ
void remove()£ºÉ¾³ýµü´úÆ÷¸ÕÔ½¹ýµÄÔªËØ
×¢Ò⣺JavaÖеĵü´úÆ÷ÓëSTLÖеĵü´úÆ÷ÔÚ¸ÅÄîÉÏÓкÜÖØÒªµÄÇø±ð¡£ÔÚSTLÖУ¬µü´úÆ÷ÀàËÆÓÚÊý×éµÄË÷Òý£¬Ê¹ÓÃÕâÖÖµü´úÆ÷¿ÉÒԲ鿴´æ·ÅÔÚ¸ÃλÖÃÉϵÄÔªËØ£¨ÀàËÆÓÚͨ¹ýÊý×éË÷ÒýiÀ´·ÃÎÊc[i]Ò»Ñù£©¡£JavaÖеĵü´úÆ÷²¢²»ÕâÑùÔËÐС£²é¿´ÓëλÖõı仯½ôÃܵĽáºÏÔÚÒ»Æð¡£Ã¿´Îͨ¹ýnext()·ÃÎÊÒ»¸öÔªËصÄͬʱ£¬µü´úÆ÷µÄλÖûá×Ô¶¯ÏòÇ°×ßÒ»²½¡£
Õâ¸öÎÊÌâ¿ÉÒÔÕâÑùÀí½â£ºJavaÖеĵü´úÆ÷Ö¸ÏòµÄλÖò¢²»ÊÇÔªËØ£¬¶øÊÇÔªËØÖ®¼ä¡£ÕâÑù£¬Ã¿´Îµ÷ÓÃnext()ʱ£¬µü´úÆ÷±ãÔ½¹ýÏÂÒ»¸öÔªËØ£¬Í¬Ê±·µ»ØËü¸ÕÔ½¹ýµÄÄǸöÔªËصÄÒýÓá£
¸ù¾ÝÉÏÃæµÄ˵Ã÷£¬ºÜÈÝÒ׵óöÏÂÃæµÄ´úÂë
Ïà¹ØÎĵµ£º
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
Ò»£ºÀí½âJava¶àÏß³Ì
¶àÏß³ÌÊÇÕâÑùÒ»ÖÖ»úÖÆ£¬ËüÔÊÐíÔÚ³ÌÐòÖв¢·¢Ö´Ðжà¸öÖ¸ÁîÁ÷£¬Ã¿¸öÖ¸ÁîÁ÷¶¼³ÆΪһ¸öỊ̈߳¬±Ë´Ë¼ä»¥Ïà¶ÀÁ¢¡£Ïß³ÌÓÖ³ÆΪÇáÁ¿¼¶½ø³Ì£¬ËüºÍ½ø³ÌÒ»ÑùÓµÓжÀÁ¢µÄÖ´ÐпØÖÆ£¬ÓɲÙ×÷ϵͳ¸ºÔðµ÷¶È£¬Çø±ðÔÚÓÚÏß³ÌûÓжÀÁ¢µÄ´æ´¢¿Õ¼ä£¬¶øÊǺÍËùÊô½ø³ÌÖеÄÆäËüÏ̹߳²ÏíÒ»¸ö´æ´¢¿Õ¼ä£¬ÕâʹµÃÏ̼߳äµÄͨÐÅÔ¶½Ï½ø³Ì¼òµ¥¡£ ......
ת×Ô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¾µäÖ§³Ö£ ......
ÕâÊÇÒ»¸öC/SÖ®¼äͨÐŵÄÀý×Ó,ÔÚJDK1.4ϲâÊÔͨ¹ý.
//·þÎñÆ÷¶ËÔ´³ÌÐòtcpserver.java
import java.io.*;
import java.net.*;
public class tcpserver
{
public static void main(String[] args) throws IOException
{
......
ÔÚoracleÖе÷ÓÃjava³ÌÐò,×¢Òâ:java·½·¨±ØÐëÊÇstaticÀàÐ͵Ä,Èç¹ûÏëÔÚJAVAÖÐʹÓÃsystem.out/errÊä³ölog.
ÐèÒªÔÚoracle ÖÐÖ´ÐÐ"call dbms_java.set_output(5000);".
Ò»¡¢helloWord
1 ±àдJAVA³ÌÐò,Ò²ÊÇÔÚSQL/PLUSÖÐд,²¢Ö´ÐÐ.
create or replace and compile java source named hello as
public ......