JavaÖм¯ºÏÈÝÆ÷ÀàListºÍSetµÄÓ÷¨
ListµÄÓ÷¨
List°üÀ¨List½Ó¿ÚÒÔ¼°List½Ó¿ÚµÄËùÓÐʵÏÖÀà¡£ÒòΪList½Ó¿ÚʵÏÖÁËCollection½Ó¿Ú£¬ËùÒÔList½Ó¿ÚÓµÓÐCollection½Ó¿ÚÌṩµÄËùÓг£Ó÷½·¨£¬ÓÖÒòΪListÊÇÁбíÀàÐÍ£¬ËùÒÔList½Ó¿Ú»¹ÌṩÁËһЩÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨£¬Èç±í1Ëùʾ¡£
±í1 List½Ó¿Ú¶¨ÒåµÄ³£Ó÷½·¨¼°¹¦ÄÜ
´Ó±í1¿ÉÒÔ¿´³ö£¬List½Ó¿ÚÌṩµÄÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨¾ùÓëË÷ÒýÓйأ¬ÕâÊÇÒòΪList¼¯ºÏΪÁбíÀàÐÍ£¬ÒÔÏßÐÔ·½Ê½´æ´¢¶ÔÏ󣬿ÉÒÔͨ¹ý¶ÔÏóµÄË÷Òý²Ù×÷¶ÔÏó¡£
List½Ó¿ÚµÄ³£ÓÃʵÏÖÀàÓÐArrayListºÍLinkedList£¬ÔÚʹÓÃList¼¯ºÏʱ£¬Í¨³£Çé¿öÏÂÉùÃ÷ΪListÀàÐÍ£¬ÊµÀý»¯Ê±¸ù¾Ýʵ¼ÊÇé¿öµÄÐèÒª£¬ÊµÀý»¯ÎªArrayList»òLinkedList£¬ÀýÈ磺
List<String> l = new ArrayList<String>();// ÀûÓÃArrayListÀàʵÀý»¯List¼¯ºÏ
List<String> l2 = new LinkedList<String>();// ÀûÓÃLinkedListÀàʵÀý»¯List¼¯ºÏ
1£®add(int index, Object obj)·½·¨ºÍset(int index, Object obj)·½·¨µÄÇø±ð
ÔÚʹÓÃList¼¯ºÏʱÐèҪעÒâÇø·Öadd(int index, Object obj)·½·¨ºÍset(int index, Object obj)·½·¨£¬Ç°ÕßÊÇÏòÖ¸¶¨Ë÷ÒýλÖÃÌí¼Ó¶ÔÏ󣬶øºóÕßÊÇÐÞ¸ÄÖ¸¶¨Ë÷ÒýλÖõĶÔÏó£¬ÀýÈçÖ´ÐÐÏÂÃæµÄ´úÂ룺
src\com\mwq\TestCollection.java¹Ø¼ü´úÂ룺
public static void main(String[] args) {
String a = "A", b = "B", c = "C", d = "D", e = "E";
List<String> list = new LinkedList<String>();
list.add(a);
list.add(e);
list.add(d);
list.set(1, b);// ½«Ë÷ÒýλÖÃΪ1µÄ¶ÔÏóeÐÞ¸ÄΪ¶ÔÏób
list.add(2, c);// ½«¶ÔÏócÌí¼Óµ½Ë÷ÒýλÖÃΪ2µÄλÖÃ
Iterator<String> it = list.iterator();
while (it.hasNext()) {
System.out.println(it.next());
}
}
ÔÚ¿ØÖÆ̨½«Êä³öÈçÏÂÐÅÏ¢£º
A
B
C
D
ÒòΪList¼¯ºÏ¿ÉÒÔͨ¹ýË÷ÒýλÖ÷ÃÎʶÔÏó£¬ËùÒÔ»¹¿ÉÒÔͨ¹ýforÑ»·±éÀúList¼¯ºÏ£¬ÀýÈç±éÀúÉÏÃæ´úÂëÖеÄList¼¯ºÏµÄ´úÂëÈçÏ£º
src\com\mwq\TestCollection.java¹Ø¼ü´úÂ룺
for (int i = 0; i < list.size(); i++) {
System.out.println(list.get(i));// ÀûÓÃget(int index)·½·¨»ñµÃÖ¸¶¨Ë÷ÒýλÖõĶÔÏó
}
src\com\mwq\TestCollection.javaÍêÕû´úÂëÈçÏ£º
package com.mwq;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Iterator;
import java.util.List;
public class TestCollection {
public static void main(String[] a
Ïà¹ØÎĵµ£º
ÔÌâÈçÏÂ:
ÓÃ×Ö·û´®ÊäÈëµÄ·½Ê½±àдһ¸ö¼òµ¥µÄͨѶ¼¡£´ËͨѶ¼ÓɶàÌõ¼Ç¼¹¹³É¡£
ÿÌõ¼Ç¼°üÀ¨Ò»¸öÁªÏµÈ˵ÄÐÕÃû¡¢ÐԱ𡢵绰¡¢Í¨ÐŵØÖ·£¬²¢¾ßÓвéѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ýµÈ¹¦ÄÜ£¬
ÇÒÿִÐÐÒ»´Î¹¦ÄܲÙ×÷ºó£¬¿ÉÒÔÑ¡ÔñÓÃÀàËÆÒÔϵĸñʽ£¬Êä³öͨѶ¼µÄËùÓÐÐÅÏ¢¼Ç¼£º
±àºÅ ÐÕÃû &nbs ......
javaµÄRuntime.getRuntime().exec(commandStr)¿ÉÒÔµ÷ÓÃÖ´ÐÐcmdÖ¸Áî¡£
cmd /c xxÊÇÖ´ÐÐÍêxxÃüÁîºó¹Ø±ÕÃüÁî´°¿Ú¡£
cmd /k xxÊÇÖ´ÐÐÍêxxÃüÁîºó²»¹Ø±ÕÃüÁî´°¿Ú¡£
cmd /c start xx»á´ò¿ªÒ»¸öд°¿ÚºóÖ´ÐÐxxÖ¸ÁԴ°¿Ú»á¹Ø±Õ¡£
cmd /k start xx»á´ò¿ªÒ»¸öд°¿ÚºóÖ´ÐÐxxÖ¸ÁԴ°¿Ú²»»á¹Ø±Õ¡£
¿ÉÒÔÓÃcmd /?²é¿´°ïÖúÐÅÏ¢¡£ ......
http://blog.csdn.net/silentbalanceyh/archive/2009/09/24/4587371.aspx
¡¾ÎªÁËÈöÁÕß¿´ÆðÀ´±È½ÏÓнṹ£¬ÎÒ×Ô¼ºÄâÁËÒ»·ÝÍêÕûµÄÌá¸Ù£¬¶øÇÒΪÁËʹµÃ¶ÁÕßÒ»±ßѧϰÀíÂÛÒ»±ßѧϰÏà¹Ø´úÂëÄÚÈÝ£¬ÀïÃæ90%µÄ´úÂëÎÒ¶¼ÌṩÁËÍêÕûµÄ´úÂëDemo£¬Ö±½Ó¼üÈë¹ýºóÓ¦¸Ã¾Í¿ÉÒÔÔËÐУ¬¶øÇÒÀïÃæËùÓеÄÖصãÎÒ¶¼±ê×¢³öÀ´ÁË£¬Ö÷ÒªÊÇ·½±ã¶ÁÕß²»»áÒÅ©µ ......
ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£ºrequest.getRemoteAddr£¨£©£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁËApache£¬SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæʵIPµØÖ·ÁË¡£
Èç¹ûʹÓÃÁË·´Ïò´úÀíÈí¼þ£¬½«http://192.168.1.110£º2046/ µÄURL·´Ïò´úÀíΪ http://www.javapeixun.com.cn / µÄURLÊ ......
µ±JVM£¨JavaÐéÄâ»ú£©Æô¶¯Ê±£¬»áÐγÉÓÉÈý¸öÀà¼ÓÔØÆ÷×é³ÉµÄ³õʼÀà¼ÓÔØÆ÷²ã´Î½á¹¹£º
bootstrap classloader
|
extension classloader
&n ......