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

¡¾×ª¡¿Java³ÌÐòÐÔÄÜÓÅ»¯

Ò»¡¢±ÜÃâÔÚÑ­»·Ìõ¼þÖÐʹÓø´ÔÓ±í´ïʽ
ÔÚ²»×ö±àÒëÓÅ»¯µÄÇé¿öÏ£¬ÔÚÑ­»·ÖУ¬Ñ­»·Ìõ¼þ»á±»·´¸´¼ÆË㣬Èç¹û²»Ê¹Óø´ÔÓ±í´ïʽ£¬¶øʹѭ»·Ìõ¼þÖµ²»±äµÄ»°£¬³ÌÐò½«»áÔËÐеĸü¿ì¡£
Àý×Ó£º
import java.util.Vector;
class CEL {
    void method (Vector vector) {
        for (int i = 0; i < vector.size (); i++)  // Violation
            ; // ...
    }
}
¸üÕý£º
class CEL_fixed {
    void method (Vector vector) {
        int size = vector.size ()
        for (int i = 0; i < size; i++)
            ; // ...
    }
}
¶þ¡¢Îª'Vectors' ºÍ 'Hashtables'¶¨Òå³õʼ´óС
JVMΪVectorÀ©³ä´óСµÄʱºòÐèÒªÖØд´½¨Ò»¸ö¸ü´óµÄÊý×飬½«Ô­Ô­ÏÈÊý×éÖеÄÄÚÈݸ´ÖƹýÀ´£¬×îºó£¬Ô­ÏȵÄÊý×éÔÙ±»»ØÊÕ¡£¿É¼ûVectorÈÝÁ¿µÄÀ©´óÊÇÒ»¸öÆÄ·Ñʱ¼äµÄÊ¡£
ͨ³££¬Ä¬ÈϵÄ10¸öÔªËØ´óСÊDz»¹»µÄ¡£Äã×îºÃÄÜ׼ȷµÄ¹À¼ÆÄãËùÐèÒªµÄ×î¼Ñ´óС¡£
Àý×Ó£º
import java.util.Vector;
public class DIC {
    public void addObjects (Object[] o) {
        // if length > 10, Vector needs to expand
        for (int i = 0; i< o.length;i++) {   
            v.add(o);   // capacity before it can add more elements.
        }
    }
    public Vector v = new Vector();  // no initialCapacity.
}
¸üÕý£º
×Ô¼ºÉ趨³õʼ´óС¡£
    public Vector v = new Vector(20); 
    public Hashtable hash = new Hashtable(10);
²Î¿¼×ÊÁÏ£º
Dov Bulka, "Java Performance and Scalability Volume 1: Server-Side Programming
Techniques" Addison Wesley, ISBN: 0-201-70429-3 pp.55 – 57
Èý¡¢ÔÚfinally¿éÖйرÕStream
³ÌÐòÖÐʹÓ


Ïà¹ØÎĵµ£º

javaÉú²úexcelÎĵµ

ÏÂÔصØÖ· ¿ÉÒÔÔÚeclpseÖÐÅܵÄ
Éú²úexcelÓ¦Óãº
package com.lihp.exl;
/**
 Ä¿µÄ£ºÌṩÓÉÊý¾Ý¶ÔÏ󼯺ÏÀࣨVector£©Éú³ÉExcel¹¤×÷±íµÄ¹¦ÄÜ
 ×÷Õߣºlihaipeng
 */
import java.io.*;
import java.util.*;
import java.lang.reflect.Method;
import org.apache.poi.hssf.usermodel.HSSFSheet;
impor ......

ÿ¸öJava³õѧÕ߶¼¸ÃÃ÷°×µÄÎÊÌâ

ÿ¸öJava³õѧÕ߶¼Ó¦¸ÃÃ÷°×µÄÎÊÌâ
¶ÔÓÚÕâ¸öϵÁÐÀïµÄÎÊÌ⣬ÿ¸öѧJavaµÄÈ˶¼Ó¦¸Ã¸ã¶®¡£µ±È»£¬Èç¹ûÖ»ÊÇѧJavaÍæÍæ¾ÍÎÞËùνÁË¡£Èç¹ûÄãÈÏΪ×Ô¼ºÒѾ­³¬Ô½³õѧÕßÁË£¬È´²»ºÜ¶®ÕâЩÎÊÌ⣬Ç뽫Äã×Ô¼ºÖعé³õѧÕßÐÐÁС£ÄÚÈݾùÀ´×ÔÓÚCSDNµÄ¾­µäÀÏÌù¡£
¡¡¡¡ÎÊÌâÒ»£ºÎÒÉùÃ÷ÁËʲô£¡
String s = "Hello world!";
¡¡¡¡Ðí¶àÈ˶¼×ö¹ýÕâÑùµÄ ......

javaMail java·¢ËÍemail

·¢ËÍemailÓ¦Óã»
package mail;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import sun.misc.BASE64Encoder;
public class Mail {
 // ¶¨Òå·¢¼þÈËÏÔʾÃû³Æ¡¢·¢¼þÈË¡¢ÊÕ¼þÈË¡¢³­ËÍ¡¢SMTP·þÎñÆ÷¡¢Óû§Ãû¡¢ÃÜÂë¡¢Ö÷Ìâ¡¢ÄÚÈݵÈ
 private String d ......

Java ÖÐÀà±äÁ¿ÓëʵÀý±äÁ¿µÄÇø±ð

javaÀàµÄ³ÉÔ±±äÁ¿ÓÐÁ©ÖÖ£º
Ò»ÖÖÊDZ»static¹Ø¼ü×ÖÐÞÊεıäÁ¿£¬½ÐÀà±äÁ¿»òÕß¾²Ì¬±äÁ¿
ÁíÒ»ÖÖûÓÐstaticÐÞÊΣ¬ÎªÊµÀý±äÁ¿ ÀàµÄ¾²Ì¬±äÁ¿ÔÚÄÚ´æÖÐÖ»ÓÐÒ»¸ö£¬javaÐéÄâ»úÔÚ¼ÓÔØÀàµÄ¹ý³ÌÖÐΪ¾²Ì¬±äÁ¿·ÖÅäÄڴ棬¾²Ì¬±äÁ¿Î»ÓÚ·½·¨Çø£¬±»ÀàµÄËùÓÐʵÀý¹²Ïí¡£ ¾²Ì¬±äÁ¿¿ÉÒÔÖ±½Óͨ¹ýÀàÃû½øÐзÃÎÊ£¬ÆäÉúÃüÖÜÆÚÈ¡¾öÓÚÀàµÄÉú ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ