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

JAVAÀ༯¿ò¼ÜÖ÷Òª½Ó¿Ú

13.1.2  À༯¿ò¼ÜÖ÷Òª½Ó¿Ú
ÔÚÕû¸öJavaÀ༯ÖÐ×ʹÓõÄÀ༯½Ó¿ÚÊÇ£ºCollection¡¢List¡¢Set¡¢Map¡¢Iterator¡¢ListIterator¡¢Enumeration¡¢SortedSet¡¢SortedMap¡¢Queue¡¢Map.Entry£¬ÕâЩ½Ó¿ÚµÄ¾ßÌåÌصãÈç±í13-1Ëùʾ¡£
±í13-1  À༯¿ò¼Ü½Ó¿ÚµÄ¾ßÌåÌصã
Ðò    ºÅ
½Ó    ¿Ú
Ãè    Êö
1
Collection
ÊÇ´æ·ÅÒ»×éµ¥ÖµµÄ×î´ó½Ó¿Ú£¬ËùνµÄµ¥ÖµÊÇÖ¸
¼¯ºÏÖеÄÿ¸öÔªËض¼ÊÇÒ»¸ö¶ÔÏó¡£Ò»°ãºÜÉÙ
Ö±½ÓʹÓô˽ӿÚÖ±½Ó²Ù×÷
2
List
ÊÇCollection½Ó¿ÚµÄ×Ó½Ó¿Ú£¬Ò²ÊÇ×î³£ÓõĽӿڡ£
´Ë½Ó¿Ú¶ÔCollection½Ó¿Ú½øÐÐÁË´óÁ¿µÄÀ©³ä£¬
ÀïÃæµÄÄÚÈÝÊÇÔÊÐíÖظ´µÄ
3
Set
ÊÇCollection½Ó¿ÚµÄ×ÓÀ࣬ûÓжÔCollection
½Ó¿Ú½øÐÐÀ©³ä£¬ÀïÃæ²»ÔÊÐí´æ·ÅÖظ´ÄÚÈÝ
4
Map
ÊÇ´æ·ÅÒ»¶ÔÖµµÄ×î´ó½Ó¿Ú£¬¼´½Ó¿ÚÖеÄÿ¸ö
ÔªËض¼ÊÇÒ»¶Ô£¬ÒÔkey→valueµÄÐÎʽ±£´æ
5
Iterator
¼¯ºÏµÄÊä³ö½Ó¿Ú£¬ÓÃÓÚÊä³ö¼¯ºÏÖеÄÄÚÈÝ£¬
Ö»ÄܽøÐдÓÇ°µ½ºóµÄµ¥ÏòÊä³ö
6
ListIterator
ÊÇIteratorµÄ×Ó½Ó¿Ú£¬¿ÉÒÔ½øÐÐË«ÏòÊä³ö
7
Enumeration
ÊÇ×îÔçµÄÊä³ö½Ó¿Ú£¬ÓÃÓÚÊä³öÖ¸¶¨¼¯ºÏÖеÄÄÚÈÝ
8
SortedSet
µ¥ÖµµÄÅÅÐò½Ó¿Ú£¬ÊµÏִ˽ӿڵļ¯ºÏÀ࣬
ÀïÃæµÄÄÚÈÝ¿ÉÒÔʹÓñȽÏÆ÷ÅÅÐò
9
SortedMap
´æ·ÅÒ»¶ÔÖµµÄÅÅÐò½Ó¿Ú£¬ÊµÏִ˽ӿڵļ¯ºÏÀ࣬
ÀïÃæµÄÄÚÈÝ°´ÕÕkeyÅÅÐò£¬Ê¹ÓñȽÏÆ÷ÅÅÐò
10
Queue
¶ÓÁнӿڣ¬´Ë½Ó¿ÚµÄ×ÓÀà¿ÉÒÔʵÏÖ¶ÓÁвÙ×÷
11
Map.Entry
Map.EntryµÄÄÚ²¿½Ó¿Ú£¬Ã¿¸öMap.Entry¶ÔÏó
¶¼±£´æ×ÅÒ»¶Ôkey→valueµÄÄÚÈÝ£¬Ã¿¸öMap
½Ó¿ÚÖж¼±£´æÓжà¸öMap.Entry½Ó¿ÚʵÀý
ÕâЩ½Ó¿ÚÖб¾ÉíÊÇ´æÔڼ̳йØϵµÄ£¬ÆäÖв¿·Ö½Ó¿ÚµÄ¼Ì³Ð¹ØϵÈçͼ13-1Ëùʾ¡£
 
£¨µã»÷²é¿´´óͼ£©Í¼13-1  ½Ó¿ÚµÄ¼Ì³Ð¹Øϵ
ÏÂÃ潫½éÉÜÕâЩ½Ó¿ÚµÄ×÷Óü°Æä³£ÓÃ×ÓÀà¡£
UÌáʾ£ºSortedXx¶¨ÒåµÄ½Ó¿Ú¶¼ÊôÓÚÅÅÐò½Ó¿Ú¡£
ÔÚJavaÀ༯Öз²ÊÇÒÔSorted¿ªÍ·µÄÈ«²¿¶¼ÊôÓÚÅÅÐòµÄ½Ó¿Ú£¬ÈçSortedSet¡¢SortedMap¡£
13.2.1  Collection½Ó¿ÚµÄ¶¨Òå
Collection½Ó¿ÚµÄ¶¨ÒåÈçÏ£º
public interface Collection<E> extends Iterable<E>
´Ó½Ó¿ÚµÄ¶¨ÒåÖпÉÒÔ·¢ÏÖ£¬´Ë½Ó¿ÚʹÓÃÁË·ºÐ͵Ķ¨Ò壬ÔÚ²Ù×÷ʱ±ØÐëÖ¸¶¨¾ßÌåµÄ²Ù×÷ÀàÐÍ¡£ÕâÑù¿ÉÒÔ±£Ö¤À༯²Ù×÷µÄ°²È«ÐÔ£¬±ÜÃâ·¢ÉúClassCastExceptionÒì³£¡£
UÌáʾ£ºJDK 1.5Ö®ºóÀ༯²ÅÔö¼ÓÁË·ºÐ͵ÄÖ§³Ö¡£
ÔÚJDK 1.5֮ǰµÄÀ༯¿ò¼ÜÖпÉÒÔ´æ·ÅÈÎÒâµÄ¶ÔÏóµ½¼¯ºÏÖУ¬ÕâÑùÒ»À´ÔÚ²Ù×÷ʱ¾Í¿ÉÄܳöÏÖÒòΪÀàÐͲ»Í³Ò»¶øÔì³Éµ


Ïà¹ØÎĵµ£º

javaÐéÄâ»ú

ʲôÊÇJavaÐéÄâ»ú
JavaÐéÄâ»ú£¨Java Virtual Machine) ¼ò³ÆJVM
¡¡¡¡JavaÐéÄâ»úÊÇÒ»¸öÏëÏóÖеĻúÆ÷,ÔÚʵ¼ÊµÄ¼ÆËã»úÉÏͨ¹ýÈí¼þÄ£ÄâÀ´ÊµÏÖ¡£JavaÐéÄâ»úÓÐ×Ô¼ºÏëÏóÖеÄÓ²¼þ,Èç´¦ÀíÆ÷¡¢¶ÑÕ»¡¢¼Ä´æÆ÷µÈ,»¹¾ßÓÐÏàÓ¦µÄÖ¸Áîϵͳ¡£
JavaÐéÄâ»úµÄÌصã
¡¡¡¡JavaÓïÑÔµÄÒ»¸ö·Ç³£ÖØÒªµÄÌصã¾ÍÊÇÓëƽ̨µÄÎÞ¹ØÐÔ¡£¶øʹÓÃJavaÐéÄâ»úÊÇÊµÏ ......

µÚÒ»¸öjava appletС³ÌÐò

³Ã׎ñÌ컹Óе㾫Á¦£¬½«¸Õ¸Õѧ»áµÄAPPLETд³öÀ´¡£
¸Ð¾õÓüÇʱ¾±à¼­³ÌÐòÌ«³ÔÁ¦£¬²»¹ýÏÖÔÚÊÇ´¦ÓÚѧϰ½×¶Î£¬ÏÈ°Ñ»ù±¾µÄ¶«Î÷ÕÆÎÕÁË°É¡£
JAVA APPLET¾ÍÊÇÓÃJAVAÓïÑÔ±àдµÄһЩСӦÓóÌÐò£¬ËüÃÇ¿ÉÒÔÖ±½ÓǶÈëµ½ÍøÒ³ÖлòÕßÆäËûÌض¨ÈÝÆ÷ÖУ¬²¢²úÉúÌØÊâµÄЧ¹û¡£
JAVA APPLET³ÌÐò²»Êǽ«main·½·¨×÷ΪÈë¿Ú¡£
µÚÒ»¸öAPPLET³ÌÐò£º
´ò ......

javaÅúÁ¿µ¼Èëexcelµ½MysqlÊý¾Ý¿â

package com.google.i_sales.service.data;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.uti ......

JavaÃæÊÔ¾­µäÊÔÌâ¼°´ð°¸

µÚÒ»£¬Ì¸Ì¸final, finally, finalizeµÄÇø±ð¡£ ¡¡¡¡
final—ÐÞÊηû£¨¹Ø¼ü×Ö£©Èç¹ûÒ»¸öÀà±»ÉùÃ÷Ϊfinal£¬Òâζ×ÅËü²»ÄÜÔÙÅÉÉú³öеÄ×ÓÀ࣬²»ÄÜ×÷Ϊ¸¸Àà±»¼Ì³Ð¡£Òò´ËÒ»¸öÀ಻Äܼȱ»ÉùÃ÷Ϊ
abstractµÄ£¬ÓÖ±»ÉùÃ÷ΪfinalµÄ¡£½«±äÁ¿»ò·½·¨ÉùÃ÷Ϊfinal£¬¿ÉÒÔ±£Ö¤ËüÃÇÔÚʹÓÃÖв»±»¸Ä±ä¡£±»ÉùÃ÷ΪfinalµÄ±äÁ¿±ØÐëÔÚÉùÃ÷ʱ¸ø¶¨ ......

JavaÊäÈëÊä³öÁ÷ ¸´ÖÆÎļþ

   ¸Õ¿ªÊ¼Ñ§Ï°Java,Ò»Ö±Ïëѧµ«×ÜÊǼá³Ö²»ÏÂÀ´,»Øµ½¼Ò¾ÍÏë×ÅÍæÓÎÏ·,¿´À´ÊÇҪϾöÐÄÁË,2010ÄêÒªºÃºÃѧϰJavaÁË.
   ÕâÊÇÔÚÍøÉÏ¿´µ½µÄÁ½¸öСÀý×Ó,×Ô¼ºÒ²×öÁËÒ»±é.
    1.
    try
{
FileInputStream in=new FileInputStream("C:/1.txt");
FileOutput ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ