java¼¯ºÏÀà
ArrayList ºÍVectorÊDzÉÓÃÊý×鷽ʽ´æ´¢Êý¾Ý£¬´ËÊý×éÔªËØÊý´óÓÚʵ¼Ê´æ´¢µÄÊý¾ÝÒÔ±ãÔö¼ÓºÍ²åÈëÔªËØ£¬¶¼ÔÊÐíÖ±½ÓÐòºÅË÷ÒýÔªËØ£¬µ«ÊDzåÈëÊý¾ÝÒªÉè¼Æµ½Êý×éÔªËØÒƶ¯µÈÄÚ´æ²Ù×÷£¬ËùÒÔË÷ÒýÊý¾Ý¿ì²åÈëÊý¾ÝÂý£¬VectorÓÉÓÚʹÓÃÁËsynchronized·½·¨£¨Ḭ̈߳²È«£©ËùÒÔÐÔÄÜÉϱÈArrayListÒª²î£¬LinkedListʹÓÃË«ÏòÁ´±íʵÏÖ´æ´¢£¬°´ÐòºÅË÷ÒýÊý¾ÝÐèÒª½øÐÐÏòÇ°»òÏòºó±éÀú£¬µ«ÊDzåÈëÊý¾ÝʱֻÐèÒª¼Ç¼±¾ÏîµÄÇ°ºóÏî¼´¿É£¬ËùÒÔ²åÈëÊý¶È½Ï¿ì£¡
ÏßÐÔ±í£¬Á´±í£¬¹þÏ£±íÊdz£ÓõÄÊý¾Ý½á¹¹£¬ÔÚ½øÐÐJava¿ª·¢Ê±£¬JDKÒѾΪÎÒÃÇÌṩÁËһϵÁÐÏàÓ¦µÄÀàÀ´ÊµÏÖ»ù±¾µÄÊý¾Ý½á¹¹¡£ÕâЩÀà¾ùÔÚjava.util°üÖС£±¾ÎÄÊÔͼͨ¹ý¼òµ¥µÄÃèÊö£¬Ïò¶ÁÕß²ûÊö¸÷¸öÀàµÄ×÷ÓÃÒÔ¼°ÈçºÎÕýȷʹÓÃÕâЩÀà¡£
Collection
©ÀList
©¦©ÀLinkedList
©¦©ÀArrayList
©¦©¸Vector
©¦¡¡©¸Stack
©¸Set
Map
©ÀHashtable
©ÀHashMap
©¸WeakHashMap
Collection½Ó¿Ú
¡¡¡¡CollectionÊÇ×î»ù±¾µÄ¼¯ºÏ½Ó¿Ú£¬Ò»¸öCollection´ú±íÒ»×éObject£¬¼´CollectionµÄÔªËØ£¨Elements£©¡£Ò»Ð©CollectionÔÊÐíÏàͬµÄÔªËضøÁíһЩ²»ÐС£Ò»Ð©ÄÜÅÅÐò¶øÁíһЩ²»ÐС£Java SDK²»Ìṩֱ½Ó¼Ì³Ð×ÔCollectionµÄÀ࣬Java SDKÌṩµÄÀ඼ÊǼ̳Ð×ÔCollectionµÄ“×Ó½Ó¿Ú”ÈçListºÍSet¡£
¡¡¡¡ËùÓÐʵÏÖCollection½Ó¿ÚµÄÀ඼±ØÐëÌṩÁ½¸ö±ê×¼µÄ¹¹Ô캯Êý£ºÎÞ²ÎÊýµÄ¹¹Ô캯ÊýÓÃÓÚ´´½¨Ò»¸ö¿ÕµÄCollection£¬ÓÐÒ»¸öCollection²ÎÊýµÄ¹¹Ô캯ÊýÓÃÓÚ´´½¨Ò»¸öеÄCollection£¬Õâ¸öеÄCollectionÓë´«ÈëµÄCollectionÓÐÏàͬµÄÔªËØ¡£ºóÒ»¸ö¹¹Ô캯ÊýÔÊÐíÓû§¸´ÖÆÒ»¸öCollection¡£
¡¡¡¡ÈçºÎ±éÀúCollectionÖеÄÿһ¸öÔªËØ£¿²»ÂÛCollectionµÄʵ¼ÊÀàÐÍÈçºÎ£¬Ëü¶¼Ö§³ÖÒ»¸öiterator()µÄ·½·¨£¬¸Ã·½·¨·µ»ØÒ»¸öµü´ú×Ó£¬Ê¹Óøõü´ú×Ó¼´¿ÉÖðÒ»·ÃÎÊCollectionÖÐÿһ¸öÔªËØ¡£µäÐ͵ÄÓ÷¨ÈçÏ£º
¡¡¡¡¡¡¡¡Iterator it = collection.iterator(); // »ñµÃÒ»¸öµü´ú×Ó
¡¡¡¡¡¡¡¡while(it.hasNext()) {
¡¡¡¡¡¡¡¡¡¡¡¡Object obj = it.next(); // µÃµ½ÏÂÒ»¸öÔªËØ
¡¡¡¡¡¡¡¡}
¡¡¡¡ÓÉCollection½Ó¿ÚÅÉÉúµÄÁ½¸ö½Ó¿ÚÊÇListºÍSet¡£
List½Ó¿Ú
¡¡¡¡ListÊÇÓÐÐòµÄCollection£¬Ê¹Óô˽ӿÚÄܹ»¾«È·µÄ¿ØÖÆÿ¸öÔªËزåÈëµÄλÖá£Óû§Äܹ»Ê¹ÓÃË÷Òý£¨ÔªËØÔÚListÖеÄλÖã¬ÀàËÆÓÚÊý×éϱ꣩À´·ÃÎÊListÖеÄÔªËØ£¬ÕâÀàËÆÓÚJavaµÄÊý×é¡£
ºÍÏÂÃæÒªÌáµ½µÄSet²»Í¬£¬ListÔÊÐíÓÐÏàͬµÄÔªËØ¡£
¡¡¡¡³ýÁ˾ßÓÐCollection½Ó¿Ú±Ø±¸µ
Ïà¹ØÎĵµ£º
ʹÓÃBigInteger´óÈÝÁ¿ÔËËãÀà¼ÆËã100µÄ½×³Ë
Ò».Ò»°ãËã·¨(Ñ»·)
public class Test {
public static void main(String[] args) {
int result = 1;
for (int i = 1; i <= 100; i++) {
result *= i;
}
System.out.println(result);
}
}
Êä³ö½á¹ûΪ0£¬ÒòΪintÎÞ·¨±£´æÏÂ100µÄ½×³ËµÄ½á¹û£¬100µ ......
JAVA³£ÓÃÀàµÄʹÓ÷½·¨
£±¡¢IntegerÀà
£²¡¢FloatÀà
£³¡¢DoubleÀà
£´¡¢CharacterÀà
£µ¡¢StringÀà
£¶¡¢StringTokenizerÀà
£·¡¢StringBufferÀà
£¸¡¢RandomÀà
1£®IntegerÀàµÄʹÓ÷½·¨
Interger£ºÕûÊýÀàÐÍ
£±¡¢ÊôÐÔ¡£
static int MAX_VALUE£º·µ»Ø×î´óµÄÕûÐÍÊý£»
static int MIN_VALUE£º·µ»Ø×îСµÄÕûÐÍÊý£»
static C ......
Ò»¡¢Îª´úÂë¼Ó×¢ÊÍ¡£ËäȻÿ¸öÈ˶¼ÖªµÀÕâµã£¬µ«ÓÐʱȴ²»×Ô¾õÍüÁËÂÄÐУ¬½ñÌìÄã“ÍüÁË”¼Ó×¢ÊÍÁËÂð£¿ËäÈ»×¢ÊͶԳÌÐòµÄ¹¦ÄÜûʲô“¹±Ï×”£¬µ«¹ýÒ»¶Îʱ¼ä£¬±ÈÈç˵Á½ÐÇÆÚÖ®ºó»òÕ߸ü³¤£¬»Ø¹ýÍ·À´¿´¿´×Ô¼ºµÄ´úÂ룬˵²»¶¨ÒѾ¼Ç²»×¡ËüÊǸÉʲôµÄÁË¡£Èç¹ûÕâЩ´úÂëÊÇÄã¸öÈ˵ģ¬ÄÇ»¹ËãÊÇ×ßÔËÁË£¬²»ÐÒµÄÊÇ£¬µ± ......
java exception ½â¾ö·½°¸ - ÎÒµÄÒì³£Íø|Òì³£|exception 770 - java.net.unknownhostException 771 - com.ibatis.struts.BeanActionException 772 - javax.servlet.jsp.JspException:Cannot find bean under name org.apache.struts.taglib.html.BEAN 773 - java.lang.NoClassDefFoundError:org apache commons lang Unhand ......
Ê×ÏÈÈ·¶¨ÓõÄServlet / JSPµÄ°æ±¾¡£
²é¿´web.xmlµÄ¿ªÍ·²¿·Ö£¬Èç¹ûÓÐÒÔÏÂÄÚÈÝ£¬±íʾÊÇServlet 2.4 / JSP 2.0¡£
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.s ......