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

JavaÖÐ ArrayList¡¢VectorºÍLinkedList µÄʹÓÃ


/*
ArrayListÊÇ×î³£ÓõÄListʵÏÖÀ࣬ÄÚ²»ÊÇͨ¹ýÊý×éʵÏֵģ¬ËüÔÊÐí¶ÔÔªËؽøÐпìËÙËæ»ú·ÃÎÊ¡£Êý×éµÄȱµãÊÇÿ¸öÔªËØÖ®¼ä²»Äܺ¬ÓГ¿Õ϶”£¬µ±Êý×é´óС²»Âú×ãʱÐèÒªÔö¼Ó´æ´¢ÄÜÁ¦£¬¾ÍÒª½«ÒÑÓÐÊý×éÊý¾Ý¸´ÖƵ½ÐµĴ洢¿Õ¼äÖС£µ±´ÓArrayListµÄÖмäλÖòåÈë»òÕßɾ³ýÔªËØʱ£¬ÐèÒª¶ÔÊý×é½øÐи´ÖÆ¡¢Òƶ¯£¬´ú¼Û±È½Ï¸ß¡£Òò´Ë£¬ËüÊʺÏËæ»ú²éÕҺͱéÀú£¬²»ÊʺϲåÈëºÍɾ³ý¡£
VectorÓëArrayListÒ»Ñù£¬Ò²ÊÇͨ¹ýÊý×éʵÏֵģ¬²»Í¬µÄÊÇËüÖ§³ÖÏ̵߳Äͬ²½£¬¼´Ä³Ò»Ê±¿ÌÖ»ÓÐÒ»¸öÏß³ÌÄܹ»Vector£¬±ÜÃâ¶àÏß³Ìͬʱд¶øÒýÆðµÄ²»Ò»ÖÂÐÔ£¬µ«ÊµÏÖͬ²½ÐèÒªºÜ¸ßµÄ»¨·Ñ£¬Òò´Ë£¬·ÃÎÊËü±È·ÃÎÊAarryListÂý
LinkedListÊÇÓÃÁ´±í½á¹¹´æ´¢Êý¾ÝµÄ£¬ºÜÊʺÏÊý¾ÝµÄ¶¯Ì¬²åÈëºÍɾ³ý£¬Ëæ»ú·ÃÎʺͱéÀúËٶȱȽÏÂý¡£ÁíÍ⣬Ëü»¹ÌṩÁËList½Ó¿ÚÖÐûÓж¨ÒåµÄ·½·¨£¬×¨ÃÅÓÃÓÚ²Ù×÷±íÍ·ºÍ±íβԪËØ£¬¿ÉÒÔµ±×ö¶ÑÕ»¡¢¶ÓÁкÍË«Ïò¶ÓÁÐʹÓá£
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Stack;
import java.util.Vector;
/**
* ÑÝʾ¸÷ÖÖListµÄʹÓÃ
* ListÊÇÄÜά»¤ÔªËصĴÎÐò£¬ËüÔÊÐíÔªËØÖظ´
*/
public class TestList {
   
    /**
     * ³õʼ»¯Ò»¸öList
     * @param list
     */
    public static void init(List list){
        if(list != null){
            list.add("aaa");
            list.add("ccc");
            list.add("bbb");
            list.add("eee");
            list.add("ddd");
        }
    }
    /**
     * Êä³öListµÄÄÚÈÝ
     * @param list
     */
    public static void output(List list){
 


Ïà¹ØÎĵµ£º

JAVA ÄÚ²¿ÀàµÄ¼òµ¥×ܽá

¶¨ÒåÔÚÒ»¸öÀàÄÚ²¿µÄÀà½ÐÄÚ²¿À࣬°üº¬ÄÚ²¿ÀàµÄÀà³ÆΪÍⲿÀà¡£ÄÚ²¿Àà¿ÉÒÔÉùÃ÷public¡¢protected¡¢privateµÈ·ÃÎÊÏÞÖÆ£¬¿ÉÒÔÉùÃ÷ΪabstractµÄ¹©ÆäËûÄÚ²¿Àà»òÍⲿÀà¼Ì³ÐÓëÀ©Õ¹£¬»òÕßÉùÃ÷Ϊstatic¡¢finalµÄ£¬Ò²¿ÉÒÔʵÏÖÌض¨µÄ½Ó¿Ú¡£staticµÄÄÚ²¿ÀàÐÐΪÉÏÏóÒ»¸ö¶ÀÁ¢µÄÀ࣬·ÇstaticÔÚÐÐΪÉÏÀàËÆÀàµÄÊôÐÔ»ò·½·¨ÇÒ½ûÖ¹ÉùÃ÷staticµÄ·½· ......

¹ØÓÚJAVA²¥·ÅÉùÒôÎļþ

£¨´ËÌù½÷Ïò£¬²ËÄñ¼¶JAVA³ÌÐòÔ±Ìṩ±ãÀû£¬ºÇºÇ£¬£¬ÈôÓÐÐÒ¸ßÊÖ³öÏÖ£¬»¹Íû¶à¶àÖ¸µã¡£Ð¡µÜÉõ»¶£¡£©
×î½üæÓÚ¿ª·¢Ò»Ì×¼à¿Øϵͳ¡£
ÐèÒª±¨¾¯ÉùÒô¡£
ÔÚÑ°Çó½â¾ö·½°¸µÄʱºò£¬³öÏÖÁ½ÖÖ·½°¸¡£
Ò»¡¢ÓÃjavax.sound.sampled.*°ü£¬½øÐÐÉùÒô´¦Àí¡£
¶þ¡¢ÓÃsun.audio.AudioPlayer°ü£¬½øÐÐÉùÒô´¦Àí¡£
µÚÒ»ÖÖ·½°¸ÓÃÆðÀ´£¬»á¾­³£ÐÔ³öÏÖ¿¨Ö ......

Java clone»úÖÆ

1¡¢ Java¶ÔÏó¸³Öµ
Java´úÂë
Employee e1=
new
 Employee(
"Àî"
); 
//EmployeeÊÇÒ»¸ö×Ô¶¨ÒåÀà 
  
Employee e2=e1; //¸³Öµ¶ÔÏó 
  
e2.setName("Íõ"
);
//¸Ä±ä¶ÔÏóe2µÄÃû×Ö 
  
System.out.println(e1.getName ......

JAVAÖеĴ«µÝ¶¼ÊÇÖµ´«µÝÂð£¿ÓÐûÓÐÒýÓô«µÝÄØ£¿

JAVAÖеĴ«µÝ¶¼ÊÇÖµ´«µÝÂð£¿ÓÐûÓÐÒýÓô«µÝÄØ£¿
ÔڻشðÕâÁ½¸öÎÊÌâÇ°£¬ÈÃÎÒÃÇÊ×ÏÈÀ´¿´Ò»¶Î´úÂ룺
Java´úÂë
public class ParamTest {
// ³õʼֵΪ0
protected int num = 0;
// Ϊ·½·¨²ÎÊýÖØи³Öµ
public void change(int i) {
i = 5;
}
// Ϊ·½·¨²ÎÊýÖØи³Öµ
public void change(ParamTest t) {
P ......

Java AnnotationÈëÃÅ

ͻ񻣼
±¾ÎÄÕë¶Ôjava³õѧÕß»òÕßannotation³õ´ÎʹÓÃÕßÈ«ÃæµØ˵Ã÷ÁËannotationµÄʹÓ÷½·¨¡¢¶¨Ò巽ʽ¡¢·ÖÀà¡£³õѧÕß¿ÉÒÔͨ¹ýÒÔÉϵÄ˵Ã÷ÖÆ×÷¼òµ¥µÄannotation³ÌÐò£¬µ«ÊǶÔÓÚһЩ¸ß¼¶µÄannotationÓ¦Óã¨ÀýÈçʹÓÃ×Ô¶¨ÒåannotationÉú³ÉjavabeanÓ³ÉäxmlÎļþ£©»¹ÐèÒª½øÒ»²½µÄÑо¿ºÍ̽ÌÖ¡£Éæ¼°µ½ÉîÈëannotationµÄÄÚÈÝ£¬×÷Õß½«ÔÚºóÎÄ¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ