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

JavaÖÐserialVersionUIDµÄ½âÊÍ

serialVersionUID×÷Óãº
       ÐòÁл¯Ê±ÎªÁ˱£³Ö°æ±¾µÄ¼æÈÝÐÔ£¬¼´ÔÚ°æ±¾Éý¼¶Ê±·´ÐòÁл¯ÈÔ±£³Ö¶ÔÏóµÄΨһÐÔ¡£
ÓÐÁ½ÖÖÉú³É·½Ê½£º
       Ò»¸öÊÇĬÈϵÄ1L£¬±ÈÈ磺private static final long serialVersionUID = 1L;
       Ò»¸öÊǸù¾ÝÀàÃû¡¢½Ó¿ÚÃû¡¢³ÉÔ±·½·¨¼°ÊôÐÔµÈÀ´Éú³ÉÒ»¸ö64λµÄ¹þÏ£×ֶΣ¬±ÈÈ磺
       private static final   long     serialVersionUID = xxxxL;
µ±ÄãÒ»¸öÀàʵÏÖÁËSerializable½Ó¿Ú£¬Èç¹ûûÓж¨ÒåserialVersionUID£¬Eclipse»áÌṩÕâ¸ö
     Ìáʾ¹¦ÄܸæËßÄãÈ¥¶¨Òå ¡£ÔÚEclipseÖеã»÷ÀàÖÐwarningµÄͼ±êһϣ¬Eclipse¾Í»á
     ×Ô¶¯¸ø¶¨Á½ÖÖÉú³ÉµÄ·½Ê½¡£Èç¹û²»Ï붨ÒåËü£¬ÔÚEclipseµÄÉèÖÃÖÐÒ²
      ¿ÉÒÔ°ÑËü¹ØµôµÄ£¬ÉèÖÃÈçÏ£º
        Window ==> Preferences ==> Java ==> Compiler ==> Error/Warnings ==>
        Potential programming problems
        ½«Serializable class without serialVersionUIDµÄwarning¸Ä³Éignore¼´¿É¡£
Èç¹ûÄãûÓп¼Âǵ½¼æÈÝÐÔÎÊÌâʱ£¬¾Í°ÑËü¹Øµô£¬²»¹ýÓÐÕâ¸ö¹¦ÄÜÊǺõģ¬Ö»ÒªÈκÎÀà±ðʵÏÖÁËSerializableÕâ¸ö½Ó¿ÚµÄ»°£¬Èç¹ûûÓмÓÈëserialVersionUID£¬Eclipse¶¼»á¸øÄãwarningÌáʾ£¬Õâ¸öserialVersionUIDΪÁËÈøÃÀà±ðSerializableÏòºó¼æÈÝ¡£
Èç¹ûÄãµÄÀàSerialized´æµ½Ó²ÅÌÉÏÃæºó£¬¿ÉÊǺóÀ´ÄãÈ´¸ü¸ÄÁËÀà±ðµÄfield(Ôö¼Ó»ò¼õÉÙ»ò¸ÄÃû)£¬µ±ÄãDeserializeʱ£¬¾Í»á³öÏÖExceptionµÄ£¬ÕâÑù¾Í»áÔì³É²»¼æÈÝÐÔµÄÎÊÌâ¡£
µ«µ±serialVersionUIDÏàͬʱ£¬Ëü¾Í»á½«²»Ò»ÑùµÄfieldÒÔtypeµÄÔ¤ÉèÖµDeserialize£¬¿É±Ü¿ª²»¼æÈÝÐÔÎÊÌâ


Ïà¹ØÎĵµ£º

java ɾ³ýList ÖеÄÖظ´Êý¾Ý

1. Ñ­»·listÖеÄËùÓÐÔªËØÈ»ºóɾ³ýÖظ´
public static List removeDuplicate(List list) {
for ( int i = 0 ; i < list.size() - 1 ; i ++ ) {
for ( int j = list.size() - 1 ; j > i; j -- ) {
if (list.get(j).equals(list.get(i))) {
......

´«ÖDz¥¿Íjavaѧϰ ½ÌÓý°ì¹«ÏµÍ³1

½ñÌ죬ÎÒÃÇ¿ªÊ¼ÁËÙ¡ÀÏʦµÄ½ÌÓý°ì¹«ÏµÍ³µÄÂọ́ºÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
      
1. ´î½¨ SSH »·¾³
      
1). ¼ÓÈë Struts:
             
¢Ù. ¼ÓÈë jar °ü:
struts-1.3.8\apps\struts-b ......

javaÖÐhashcode()ºÍequals()µÄÏê½â

תÌû×Ô http://www.javaeye.com/topic/257191
javaÖÐhashcode()ºÍequals()µÄÏê½â
1. Ê×ÏÈequals()ºÍhashcode()ÕâÁ½¸ö·½·¨¶¼ÊÇ´ÓobjectÀàÖм̳йýÀ´µÄ¡£
equals()·½·¨ÔÚobjectÀàÖж¨ÒåÈçÏ£º
  public boolean equals(Object obj) {
return (this == obj);
}
ºÜÃ÷ÏÔÊǶÔÁ½¸ö¶ÔÏóµÄµØÖ·Öµ½øÐеıȽϣ¨¼´±È½Ï ......

¶ÁÎļþ£¨java£©


ʹÓÃJava²Ù×÷Îı¾ÎļþµÄ·½·¨Ïê½â
ÕªÒª: ×î³õjavaÊDz»Ö§³Ö¶ÔÎı¾ÎļþµÄ´¦ÀíµÄ£¬ÎªÁËÃÖ²¹Õâ¸öȱº¶¶øÒýÈëÁËReaderºÍWriterÁ½¸öÀ࣬ÕâÁ½¸öÀ඼ÊdzéÏóÀ࣬WriterÖÐ write(char[] ch,int off,int
length)£¬flush()ºÍclose()·½·¨Îª³éÏó·½·¨£¬ReaderÖÐread(char[] ch,int off,int length)ºÍclose()·½·¨ÊdzéÏó·½·¨¡£×ÓÀàÓ¦¸Ã·Ö± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ