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

JAVA¼òµ¥¸ÅÄî

1.ʵÀý³ÉÔ±ºÍÀà³ÉÔ±
ʵÀý³ÉÔ±ÖÐÊÇÊôÓÚ¶ÔÏóµÄ,°üÀ¨ÊµÀý³ÉÔ±±äÁ¿ºÍʵÀý³ÉÔ±·½·¨,Ö»Óд´½¨Á˶ÔÏóÖ®ºó²ÅÄÜ·ÃÎÊʵÀý³ÉÔ±±äÁ¿ºÍʵÀý³ÉÔ±·½·¨.
    Àà³ÉÔ±ÊÇÊôÓÚÀàµÄ,Àà³ÉÔ±ÐèÒªÓùؼü×Östatic±êʶ,Ò²³ÆΪ¾²Ì¬³ÉÔ±,Àà³ÉÔ±°üÀ¨Àà³ÉÔ±±äÁ¿ºÍÀà³ÉÔ±·½·¨,ͨ¹ýÀàÃû¿ÉÒÔÖ±½Ó·ÃÎÊÀà³ÉÔ±±äÁ¿ºÍµ÷ÓÃÀà³ÉÔ±·½·¨,¼´Ê¹Ã»Óд´½¨¶ÔÏó,Ò²Äܹ»ÒýÓÃÀà³ÉÔ±,Àà³ÉÔ±Ò²¿ÉÒÔͨ¹ý¶ÔÏóÒýÓÃ.
    ½ÓÏÂÀ´½²½²Àà±äÁ¿ºÍʵÀý±äÁ¿µÄÇø±ð:
£¨1£©: ÉùÃ÷µÄ²î±ð: ûÓÐʹÓÃstaticÉùÃ÷µÄΪʵÀý³ÉÔ±±äÁ¿,ÓÃstatic ÉùÃ÷µÄΪÀà³ÉÔ±±äÁ¿
£¨2£©:´æ´¢½á¹¹µÄ²î±ð: ¶ÔÓÚʵÀý±äÁ¿¶øÑÔ,Ϊÿ¸ö¶ÔÏóµÄÿ¸öʵÀý³ÉÔ±±äÁ¿·ÖÅäÒ»¸ö´æ´¢µ¥ÔªÊ¹µÃ²»Í¬¶ÔÏóµÄʵÀý³ÉÔ±±äÁ¿¾ßÓв»Í¬µÄÖµ,¶ø¶ÔÓÚÀà³ÉÔ±±äÁ¿Ö»·ÖÅäÒ»¸ö´æ´¢µ¥Ôª,ʹµÃËùÓеĶÔÏó¹²Í¬Ê¹ÓÃÒ»¸öÀà³ÉÔ±±äÁ¿.
£¨3£©:ÒýÓ÷½Ê½µÄ²î±ð: ʵÀý³ÉÔ±±äÁ¿¶ÔÓÚ¶ÔÏó,ͨ¹ý¶ÔÏó½øÐзÃÎÊ;Àà³ÉÔ±±äÁ¿ÊôÓÚÀà,¼È¿ÉÒÔͨ¹ý¶ÔÏó,Ò²¿ÉÒÔͨ¹ýÀà·ÃÎÊ.
2.equals ·½·¨½âÎö£º£¨¡¶JAVAºËÐļ¼Êõ¡·176Ò³£©
£¨1£©¶ÔÓÚ×Ö·û´®±äÁ¿À´Ëµ£¬Ê¹ÓÓ==”ºÍ“equals()”·½·¨±È½Ï×Ö·û´®Ê±£¬Æä±È½Ï·½·¨²»Í¬¡£
“==”±È½ÏÁ½¸ö±äÁ¿±¾ÉíµÄÖµ£¬¼´Á½¸ö¶ÔÏóÔÚÄÚ´æÖеÄÊ×µØÖ·¡£“equals()”±È½Ï×Ö·û´®ÖÐËù°üº¬µÄÄÚÈÝÊÇ·ñÏàͬ¡£
£¨2£©¶ÔÓÚ·Ç×Ö·û´®±äÁ¿À´Ëµ£¬"=="ºÍ"equals"·½·¨µÄ×÷ÓÃÊÇÏàͬµÄ¶¼ÊÇÓÃÀ´±È½ÏÆä
¶ÔÏóÔÚ¶ÑÄÚ´æµÄÊ×µØÖ·£¬¼´ÓÃÀ´±È½ÏÁ½¸öÒýÓñäÁ¿ÊÇ·ñÖ¸Ïòͬһ¸ö¶ÔÏó¡£
public boolean equals(Object obj)ָʾÆäËûij¸ö¶ÔÏóÊÇ·ñÓë´Ë¶ÔÏó“ÏàµÈ”¡£
equals ·½·¨ÔÚ·Ç¿Õ¶ÔÏóÒýÓÃÉÏʵÏÖÏàµÈ¹Øϵ£º
×Ô·´ÐÔ£º¶ÔÓÚÈκηǿÕÒýÓÃÖµ x£¬x.equals(x) ¶¼Ó¦·µ»Ø true¡£
¶Ô³ÆÐÔ£º¶ÔÓÚÈκηǿÕÒýÓÃÖµ x ºÍ y£¬µ±ÇÒ½öµ± y.equals(x) ·µ»Ø true ʱ£¬x.equals(y) ²ÅÓ¦·µ»Ø true¡£
´«µÝÐÔ£º¶ÔÓÚÈκηǿÕÒýÓÃÖµ x¡¢y ºÍ z£¬Èç¹û x.equals(y) ·µ»Ø true£¬²¢ÇÒ y.equals(z) ·µ»Ø true£¬ÄÇô x.equals(z) Ó¦·µ»Ø true¡£
Ò»ÖÂÐÔ£º¶ÔÓÚÈκηǿÕÒýÓÃÖµ x ºÍ y£¬¶à´Îµ÷Óà x.equals(y) ʼÖÕ·µ»Ø true »òʼÖÕ·µ»Ø false£¬Ç°ÌáÊǶÔÏóÉÏ equals ±È½ÏÖÐËùÓõÄÐÅϢûÓб»Ð޸ġ£
¶ÔÓÚÈκηǿÕÒýÓÃÖµ x£¬x.equals(null) ¶¼Ó¦·µ»Ø false¡£
Object ÀàµÄ equals ·½·¨ÊµÏÖ¶ÔÏóÉϲî±ð¿ÉÄÜÐÔ×î´óµÄÏàµÈ¹Øϵ£»¼´£¬¶ÔÓÚÈκηǿÕÒýÓÃÖµ x ºÍ y£¬µ±ÇÒ½öµ± x ºÍ y ÒýÓÃͬһ¸ö¶ÔÏóʱ£¬´Ë·½·¨²Å·µ»Ø true£¨x == y ¾ßÓÐÖµ true£©¡£
×¢Ò⣺µ±´Ë·½


Ïà¹ØÎĵµ£º

½«Java¶ÔÏó±£´æΪXMLÎĵµ

package com.kiloway.trace.utils;
import java.lang.reflect.Field;
/**
* @author Zhang Qi
* @Create Time 2010/01/09
* */
public class ObjectToXML {
public String toString(Object object) throws Exception {
StringBuilder sb = new StringBuilder();
//µÃµ½ÀàµÄÃû³Æ
String classname = obj ......

java¹æÔ¼


1£® ¹ØÓÚ»ù´¡Êý¾ÝÀàÐÍ¡£
»¹¼ÇµÃÉÏһƬÎÄÕÂÖнáβ²¿·ÖµÄÄǸöÀý×Óô£¿
ÒòΪ¼ÆËã»úµÄ2½øÖƵÄÌØÐÔ£¬JavaÓïÑÔ£¨ÆäËûÓïÑÔºÃÏñÒ²Ò»Ñù£©ÎÞ·¨×¼È·µØ½øÐÐfloat,doubleÀàÐÍÊý¾ÝµÄ¼ÆË㣬ËùÒÔ£¬×÷ÕâЩ¼ÆËãµÄʱºòÐèÒª¿¼ÂÇʹÓÃBigDecimalן÷Àà¡£
 
2£® StringÀàÓëStringBufferÀà
JavaµÄStringÀàÌṩÈçϵļòµ¥µÄ×Ö·û´®Á¬½Ó·½· ......

Java URLClassLoader

Closing a URLClassLoader
By Michael McMahon
 
Complex Java programs, such as application servers, sometimes create their own class loaders using the URLClassLoader type. With URLClassLoader, applications can load classes and resources from a search path of URLs. The following URL types are ......

java ²»¶¨²ÎÊýʹÓÃʾÀý

public class javaTest {
public static void test(String ...strings){
for(String str: strings){
System.out.print(str + " ");
}
System.out.println();
}

public static void main(String[] args){
test("a", "b", "c", "ddd");
test( ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ