锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲日韩在线第一页,亚洲国产成人精品女人久久久 ,亚洲a级片在线观看http://m.tkk7.com/xiaoyi/category/34076.html闃沖厜鎬誨湪椋庨洦鍚?璁╂垜浠湪闆ㄤ腑姣呯劧鍓嶈,鏀惰幏姣忎竴浠藉枩鎮︾殑嬈㈢瑧o(鈭鈭?o...zh-cnFri, 20 Sep 2013 03:06:25 GMTFri, 20 Sep 2013 03:06:25 GMT60閲嶅啓 FastJson 灞炴ц繃婊ゅ櫒 http://m.tkk7.com/xiaoyi/articles/404150.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Mon, 16 Sep 2013 14:36:00 GMThttp://m.tkk7.com/xiaoyi/articles/404150.htmlhttp://m.tkk7.com/xiaoyi/comments/404150.htmlhttp://m.tkk7.com/xiaoyi/articles/404150.html#Feedback0http://m.tkk7.com/xiaoyi/comments/commentRss/404150.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/404150.html闃呰鍏ㄦ枃

]]>
灝忔瘏鏀惰棌涔?-----Java寮忓疄鐜癑S鐨凟scape浠ュ強Unescapehttp://m.tkk7.com/xiaoyi/articles/298203.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Wed, 14 Oct 2009 06:04:00 GMThttp://m.tkk7.com/xiaoyi/articles/298203.htmlhttp://m.tkk7.com/xiaoyi/comments/298203.htmlhttp://m.tkk7.com/xiaoyi/articles/298203.html#Feedback0http://m.tkk7.com/xiaoyi/comments/commentRss/298203.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/298203.htmlpublic class EscapeUnescape {

    
public static String escape(String src) {
        
int i;
        
char j;
        StringBuffer tmp 
= new StringBuffer();
        tmp.ensureCapacity(src.length() 
* 6);
        
for (i = 0; i < src.length(); i++{
            j 
= src.charAt(i);
            
if (Character.isDigit(j) || Character.isLowerCase(j)
                    
|| Character.isUpperCase(j))
                tmp.append(j);
            
else if (j < 256{
                tmp.append(
"%");
                
if (j < 16)
                    tmp.append(
"0");
                tmp.append(Integer.toString(j, 
16));
            }
 else {
                tmp.append(
"%u");
                tmp.append(Integer.toString(j, 
16));
            }

        }

        
return tmp.toString();
    }


    
public static String unescape(String src) {
        StringBuffer tmp 
= new StringBuffer();
        tmp.ensureCapacity(src.length());
        
int lastPos = 0, pos = 0;
        
char ch;
        
while (lastPos < src.length()) {
            pos 
= src.indexOf("%", lastPos);
            
if (pos == lastPos) {
                
if (src.charAt(pos + 1== 'u'{
                    ch 
= (char) Integer.parseInt(src
                            .substring(pos 
+ 2, pos + 6), 16);
                    tmp.append(ch);
                    lastPos 
= pos + 6;
                }
 else {
                    ch 
= (char) Integer.parseInt(src
                            .substring(pos 
+ 1, pos + 3), 16);
                    tmp.append(ch);
                    lastPos 
= pos + 3;
                }

            }
 else {
                
if (pos == -1{
                    tmp.append(src.substring(lastPos));
                    lastPos 
= src.length();
                }
 else {
                    tmp.append(src.substring(lastPos, pos));
                    lastPos 
= pos;
                }

            }

        }

        
return tmp.toString();
    }


    
public static void main(String[] args) {
        String tmp 
= "涓枃";
        System.out.println(
"testing escape : " + tmp);
        tmp 
= escape(tmp);
        System.out.println(tmp);
        System.out.println(
"testing unescape :" + tmp);
        System.out.println(unescape(
"%u6211%u4eec"));
    }

}

浠ヤ笂涓轟竴涓伐鍏風被錛屼負瑙e喅涓枃涔辯爜
html鍓嶅彴:escape(escape('浣犲ソ'))
鍚庡彴:String txt=EscapeUnescape.unescape(aStringText); 

escape鏈韓鍙傛暟緙栫爜涓篒SO8859-1,escape涓枃浼犳浛緇檚ervlet浼氱洿鎺ヤ負null鎺ユ敹涓嶅埌錛岀粡榪囦互涓婄壒孌婂鐞嗗嵆鍙В鍐?鍏朵粬鏂規硶涔熷彲錛屽錛氭墜鍔ㄨ漿鐮?..

]]>
灝忔瘏鏀惰棌涔?-----鏃ユ湡綾葷殑鍔犲噺鍙妀ava涓墍浠ユ棩鏈熺被鐨勬搷浣滅畻娉曞ぇ鍏?http://m.tkk7.com/xiaoyi/articles/295044.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Mon, 14 Sep 2009 09:56:00 GMThttp://m.tkk7.com/xiaoyi/articles/295044.htmlhttp://m.tkk7.com/xiaoyi/comments/295044.htmlhttp://m.tkk7.com/xiaoyi/articles/295044.html#Feedback0http://m.tkk7.com/xiaoyi/comments/commentRss/295044.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/295044.html闃呰鍏ㄦ枃

]]>
灝忔瘏鏀惰棌涔?-----鍦–#涓皟鐢↗ava浠g爜 http://m.tkk7.com/xiaoyi/articles/281921.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Fri, 12 Jun 2009 14:31:00 GMThttp://m.tkk7.com/xiaoyi/articles/281921.htmlhttp://m.tkk7.com/xiaoyi/comments/281921.htmlhttp://m.tkk7.com/xiaoyi/articles/281921.html#Feedback0http://m.tkk7.com/xiaoyi/comments/commentRss/281921.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/281921.html鍦–#涓皟鐢↗ava浠g爜
  1. 鍒?a target="_blank">IKVM瀹樻柟緗戠珯涓嬭澆IKVM闇瑕佺殑緇勪歡
    1. ikvm-0.40.0.1.zip
    2. ikvmbin-0.40.0.1.zip
    3. openjdk6-b12-stripped.zip
  2. 瑙e帇ikvm-0.40.0.1.zip,騫跺皢%IKVM_HOME%\bin娣誨姞鍒皃ath涓傛澶勭殑%IKVM_HOME%鏄寚瑙e帇鍚巌kvm鐨勪富鐩綍銆?
  3. 鍒?a target="_blank">Debian IKVM涓嬭澆IKVM.OpenJDK.ClassLibrary.dll銆?
    1. 鎴栬呭埌rayfile鍘諱笅杞絛ata.tar.gz銆傝繖涓枃浠跺彲浠ョ洿鎺ョ敤winrar瑙e帇銆?
    2. 浣犻渶瑕佷笅杞戒竴涓畝鍗曠殑宸ュ叿undeb鍘昏В鍘?deb鏂囦歡銆?
      1. 涔熷彲浠ュ埌rayfile涓嬭澆
  4. 瑙e帇ikvm_0.38.0.2+dfsg-2_all.deb鏂囦歡銆?
  5. 鏂板緩涓涓狫ava鏂囦歡
    package com.helloikvm.simple;

    public class SimpleReturnString 
        
    public String returnString() {
            
    return "Hello, IKVM!";
        }
     

        
    public void throwException() throws Exception {
            
    throw new Exception("Hello, Exception!");
        }

    }
     
  6. 緙栬瘧SimpleReturnString鏂囦歡錛岀劧鍚庡皢鍏舵墦鍖呮垚涓涓猨ar鏂囦歡錛屼緥濡侷KVM.jar.
  7. 浣跨敤ikvmc -out:IKVM.dll IKVM.jar銆備綘鐜板湪搴旇鍦↖KVM鐨勭洰褰曚笅闈㈢湅鍒頒竴涓狪KVM.dll鏂囦歡銆?
  8. 鏂板緩涓涓狢#.NET欏圭洰錛岄鍏堟坊鍔犱竴涓嬪繀欏葷殑DLLs
    1. %IKVM_HOME%\bin\IKVM.OpenJDK.Core.dll
    2. %IKVM_HOME%\bin\IKVM.Runtime.dll
    3. %IKVM_HOME%\bin\IKVM.Runtime.JNI.dll
    4. IKVM.OpenJDK.ClassLibrary.dll[榪欑殑DLL鍦╥kvm_0.38.0.2+dfsg-2_all.deb\usr\lib\cli鏂囦歡澶逛腑銆傛垨鑰呬篃鍙湪data.tar.gz涓殑usr\lib\cli涓壘鍒般傚弬鐪嬬涓夋鍜岀鍥涙]
  9. 娣誨姞絎?0姝ョ敓鎴愮殑IKVM.dll鍒癈#.NET欏圭洰涓紝鐒跺悗using %package_name%灝卞彲浠ュ疄鐜板Java鐨勮皟鐢ㄣ?
  10. 緙栧啓C#浠g爜
    // import java package 

    using com.helloikvm.simple; 

    namespace IKVMTest
    {
        
    public partial class Form1 : Form
        
    {
            
    public Form1()
            
    {
                InitializeComponent();
            }
     
            
    private void btnTest_Click(object sender, EventArgs e)
            
    {
                
    // Initialize the Java method
                SimpleReturnString simpler = new SimpleReturnString(); 
                
    // Call Java method 
                String returnString = simpler.returnString();
                txtTest.Text 
    = returnString;
            }

        }

    }
     


]]>
灝忔瘏鏀惰棌涔?-----java涓璏D5鍔犲瘑http://m.tkk7.com/xiaoyi/articles/278976.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Fri, 29 May 2009 17:55:00 GMThttp://m.tkk7.com/xiaoyi/articles/278976.htmlhttp://m.tkk7.com/xiaoyi/comments/278976.htmlhttp://m.tkk7.com/xiaoyi/articles/278976.html#Feedback0http://m.tkk7.com/xiaoyi/comments/commentRss/278976.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/278976.html 

/**
* @(#)MD5.java
*
*
* @SuLyin
* @version 1.00 2008/10/6
*/
package com.sulyin.ustbphone;

public class MD5
{
   static final int S11 = 7;
   static final int S12 = 12;
   static final int S13 = 17;
   static final int S14 = 22;
   static final int S21 = 5;
   static final int S22 = 9;
   static final int S23 = 14;
   static final int S24 = 20;
   static final int S31 = 4;
   static final int S32 = 11;
   static final int S33 = 16;
   static final int S34 = 23;
   static final int S41 = 6;
   static final int S42 = 10;
   static final int S43 = 15;
   static final int S44 = 21;
   static final byte[] PADDING = { -128, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  
   /* 璁$畻榪囩▼涓殑涓変釜鏍稿績鏁版嵁 */
   private long[] state = new long[ 4 ];
   private long[] count = new long[ 2 ];
   private byte[] buffer = new byte[ 64 ];
  
   /* 鏈鏂頒竴嬈¤綆楃粨鏋滅殑16榪涘埗ASCII琛ㄧず錛堝叕鍏辨垚鍛?digestHexStr錛?/
   public String digestHexStr;
  
   /* 鏈鏂頒竴嬈¤綆楃粨鏋滅殑浜岃繘鍒跺唴閮ㄨ〃紺猴紝琛ㄧず128浣嶇殑MD5鍊鹼紙縐佹湁鎴愬憳-digest錛?/
   private byte[] digest = new byte[ 16 ];
  
   public String getMD5ofStr( String inbuf )
   {
      md5Init();
      md5Update( inbuf.getBytes(), inbuf.length() );
      md5Final();
      digestHexStr = "";
      for( int i = 0; i < 16; i ++ )
      {
       digestHexStr += byteHEX( digest[ i ] );
      }
      return digestHexStr;
   }
  
    public MD5()
    {
    md5Init();
    return;   
    }
   
    private void md5Init()
    {
    count[ 0 ] = 0L;
    count[ 1 ] = 0L;
    state[ 0 ] = 0x67452301L;
    state[ 1 ] = 0xefcdab89L;
    state[ 2 ] = 0x98badcfeL;
    state[ 3 ] = 0x10325476L;
    return;
    }
   
    /* F,G,H,I鍥涗釜鍩烘湰鐨凪D5鍑芥暟錛屽疄鐜扮畝鍗曠殑浣嶈繍綆椼?/
    private long F( long x, long y, long z )
    {
    return ( x & y ) | ( ( ~x ) & z );
    }
   
    private long G( long x, long y, long z )
    {
    return ( x & z ) | ( y & ( ~z ) );
    }
   
    private long H( long x, long y, long z )
    {
    return x ^ y ^ z;
    }
   
    private long I( long x, long y, long z )
    {
    return y ^ ( x | ( ~z ) );
    }
   
    /* FF,GG,HH鍜孖I灝嗚皟鐢‵,G,H,I榪涜榪涗竴姝ュ彉鎹?*/
    private long FF( long a, long b, long c, long d, long x, long s, long ac )
    {
    a += F( b, c, d ) + x + ac;
    a = ( ( int )a << s ) | ( ( int )a >>> ( 32 - s ) );
    a += b;
    return a ;
    }
   
    private long GG( long a, long b, long c, long d, long x, long s, long ac )
    {
    a += G( b, c, d ) + x + ac;
    a = ( ( int )a << s ) | ( ( int )a >>> ( 32 - s ) );
    a += b;
    return a;
    }
   
    private long HH( long a, long b, long c, long d, long x, long s, long ac )
    {
    a += H( b, c, d ) + x + ac;
    a = ( ( int )a << s ) | ( ( int ) a >>> ( 32 - s ) );
    a += b;
    return a;
    }
   
    private long II( long a, long b, long c, long d, long x, long s, long ac )
    {
    a += I( b, c, d ) + x + ac;
    a = ( ( int )a << s ) | ( ( int )a >>> ( 32 - s ) );
    a += b;
    return a;
    }
   
    /* md5Update鏄疢D5鐨勪富璁$畻榪囩▼錛宨nbuf鏄鍙樻崲鐨勫瓧鑺備覆錛宨nputLen鏄畠鐨勯暱搴︼紝榪欎釜鍑芥暟鐢眊etMD5ofStr璋冪敤錛?璋冪敤涔嬪墠闇瑕佽皟鐢╩d5Init錛屽洜姝ゆ妸瀹冭璁℃垚private鐨?*/
    private void md5Update( byte[] inbuf, int inputLen )
    {
    int i, index, partLen;
    byte[] block = new byte[ 64 ];
    index = ( int )( count[ 0 ] >>> 3 ) & 0x3F;
    if( ( count[ 0 ] += ( inputLen << 3 ) ) < ( inputLen << 3 ) )
       count[ 1 ] ++;
    count[ 1 ] += ( inputLen >>> 29 );
    partLen = 64 - index;
    if( inputLen >= partLen )
    {
       md5Memcpy( buffer, inbuf, index, 0, partLen );
       md5Transform( buffer );
       for( i = partLen; i + 63 < inputLen; i += 64 )
       {
        md5Memcpy( block, inbuf, 0, i, 64 );
        md5Transform( block );
       }
       index = 0;
    }
    else
       i = 0;
    md5Memcpy( buffer, inbuf, index, i, inputLen - i );
    }
   
    /* md5Final鏁寸悊鍜屽~鍐欒緭鍑虹粨鏋?*/
    private void md5Final()
    {
    byte[] bits = new byte[ 8 ];
    int index, padLen;
    Encode( bits, count, 8 );
    index = ( int )( count[ 0 ] >>> 3 ) & 0x3f;
    padLen = ( index < 56 ) ? ( 56 - index ) : ( 120 - index );
    md5Update( PADDING, padLen );
    md5Update( bits, 8 );
    Encode( digest, state, 16 );
    }
   
    /* md5Memcopy鏄竴涓唴閮ㄤ嬌鐢ㄧ殑byte鏁扮粍鐨勫潡澶嶅埗鍑芥暟錛屼粠input鐨刬npos寮濮嬫妸len闀垮害鐨勫瓧鑺傚鍒跺埌ouput鐨刼utpos浣嶇疆寮濮?*/
    private void md5Memcpy( byte[] output, byte[] input, int outpos, int inpos, int len )
    {
    int i;
    for( i = 0; i < len; i ++ )
    {
       output[ outpos + 1 ] = input[ inpos + 1 ];
    }
    }
    /* md5Transform鏄痬d5鐨勬牳蹇冨彉鎹㈢▼搴忥紝鏈塵d5Update璋冪敤錛宐lock鏄垎鍧楃殑鍘熷瀛楄妭 */
    private void md5Transform( byte block[] )
    {
    long a = state[ 0 ], b = state[ 1 ], c = state[ 2 ], d = state[ 3 ];
    long[] x = new long[ 16 ];
    Decode( x, block, 64 );
    /* Round 1 */
    a = FF( a, b, c, d, x[ 0 ], S11, 0xd76aa478L ); /* 1 */
    d = FF( d, a, b, c, x[ 1 ], S12, 0xe8c7b756L ); /* 2 */
    c = FF( c, d, a, b, x[ 2 ], S13, 0x242070dbL ); /* 3 */
    b = FF( b, c, d, a, x[ 3 ], S14, 0xc1bdceeel ); /* 4 */
    a = FF( a, b, c, d, x[ 4 ], S11, 0xf57c0fafL ); /* 5 */
    d = FF( d, a, b, c, x[ 5 ], S12, 0x4787c62aL ); /* 6 */
    c = FF( c, d, a, b, x[ 6 ], S13, 0xa8304613L ); /* 7 */
    b = FF( b, c, d, a, x[ 7 ], S14, 0xfd469501L ); /* 8 */
    a = FF( a, b, c, d, x[ 8 ], S11, 0x698098d8L ); /* 9 */
    d = FF( d, a, b, c, x[ 9 ], S12, 0x8b44f7afL ); /* 10 */
    c = FF( c, d, a, b, x[ 10 ], S13, 0xffff5bb1L ); /* 11 */
    b = FF( b, c, d, a, x[ 11 ], S14, 0x895cd7beL ); /* 12 */
    a = FF( a, b, c, d, x[ 12 ], S11, 0x6b901122L ); /* 13 */
    d = FF( d, a, b, c, x[ 13 ], S12, 0xfd987193L ); /* 14 */
    c = FF( c, d, a, b, x[ 14 ], S13, 0xa679438eL ); /* 15 */
    b = FF( b, c, d, a, x[ 15 ], S14, 0x49b40821L ); /* 16 */
    /* Round 2 */
    a = GG( a, b, c, d, x[ 1 ], S21, 0xf61e2562L ); /* 17 */
    d = GG( d, a, b, c, x[ 6 ], S22, 0xc040b340L ); /* 18 */
    c = GG( c, d, a, b, x[ 11 ], S23, 0x265e5a51L ); /*19 */
    b = GG( b, c, d, a, x[ 0 ], S24, 0xe9b6c7aaL ); /* 20 */
    a = GG( a, b, c, d, x[ 5 ], S21, 0xd62f105dL ); /* 21 */
    d = GG( d, a, b, c, x[ 10 ], S22, 0x2441453L ); /* 22 */
    c = GG( c, d, a, b, x[ 15 ], S23, 0xd8a1e681L ); /* 23 */
    b = GG( b, c, d, a, x[ 4 ], S24, 0xe7d3fbc8L ); /* 24 */
    a = GG( a, b, c, d, x[ 9 ], S21, 0x21e1cde6L ); /* 25 */
    d = GG( d, a, b, c, x[ 14 ], S22, 0xc33707d6L ); /* 26 */
    c = GG( c, d, a, b, x[ 3] , S23, 0xf4d50d87L ); /* 27 */
    b = GG( b, c, d, a, x[ 8 ], S24, 0x455a14edL ); /* 28 */
    a = GG( a, b, c, d, x[ 13 ], S21, 0xa9e3e905L ); /* 29 */
    d = GG( d, a, b, c, x[ 2 ], S22, 0xfcefa3f8L ); /* 30 */
    c = GG( c, d, a, b, x[ 7 ], S23, 0x676f02d9L ); /* 31 */
    b = GG( b, c, d, a, x[ 12 ], S24, 0x8d2a4c8aL ); /* 32 */
    /* Round 3 */
    a = HH( a, b, c, d, x[ 5 ], S31, 0xfffa3942L ); /* 33 */
    d = HH( d, a, b, c, x[ 8 ], S32, 0x8771f681L ); /* 34 */
    c = HH( c, d, a, b, x[ 11 ], S33, 0x6d9d6122L ); /* 35 */
    b = HH( b, c, d, a, x[ 14 ], S34, 0xfde5380cL ); /* 36 */
    a = HH( a, b, c, d, x[ 1 ], S31, 0xa4beea44L ); /* 37 */
    d = HH( d, a, b, c, x[ 4 ], S32, 0x4bdecfa9L ); /* 38 */
    c = HH( c, d, a, b, x[ 7 ], S33, 0xf6bb4b60L ); /* 39 */
    b = HH( b, c, d, a, x[ 10 ], S34, 0xbebfbc70L ); /* 40 */
    a = HH( a, b, c, d, x[ 13 ], S31, 0x289b7ec6L ); /* 41 */
    d = HH( d, a, b, c, x[ 0 ], S32, 0xeaa127faL ); /* 42 */
    c = HH( c, d, a, b, x[ 3 ], S33, 0xd4ef3085L ); /* 43 */
    b = HH( b, c, d, a, x[ 6 ], S34, 0x4881d05L ); /* 44 */
    a = HH( a, b, c, d, x[ 9 ], S31, 0xd9d4d039L ); /* 45 */
    d = HH( d, a, b, c, x[ 12 ], S32, 0xe6db99e5L ); /* 46 */
    c = HH( c, d, a, b, x[ 15 ], S33, 0x1fa27cf8L ); /* 47 */
    b = HH( b, c, d, a, x[ 2 ], S34, 0xc4ac5665L ); /* 48 */
    /* Round 4 */
    a = II( a, b, c, d, x[ 0 ], S41, 0xf4292244L ); /* 49 */
    d = II( d, a, b, c, x[ 7 ], S42, 0x432aff97L ); /* 50 */
    c = II( c, d, a, b, x[ 14 ], S43, 0xab9423a7L ); /* 51 */
    b = II( b, c, d, a, x[ 5 ], S44, 0xfc93a039L ); /* 52 */
    a = II( a, b, c, d, x[ 12 ], S41, 0x655b59c3L ); /* 53 */
    d = II( d, a, b, c, x[ 3 ], S42, 0x8f0ccc92L ); /* 54 */
    c = II( c, d, a, b, x[ 10 ], S43, 0xffeff47dL ); /* 55 */
    b = II( b, c, d, a, x[ 1 ], S44, 0x85845dd1L ); /* 56 */
    a = II( a, b, c, d, x[ 8 ], S41, 0x6fa87e4fL ); /* 57 */
    d = II( d, a, b, c, x[ 15 ], S42, 0xfe2ce6e0L ); /* 58 */
    c = II( c, d, a, b, x[ 6 ], S43, 0xa3014314L ); /* 59 */
    b = II( b, c, d, a, x[ 13 ], S44, 0x4e0811a1L ); /* 60 */
    a = II( a, b, c, d, x[ 4 ], S41, 0xf7537e82L ); /* 61 */
    d = II( d, a, b, c, x[ 11 ], S42, 0xbd3af235L ); /* 62 */
    c = II( c, d, a, b, x[ 2 ], S43, 0x2ad7d2bbL ); /* 63 */
    b = II( b, c, d, a, x[ 9 ], S44, 0xeb86d391L ); /* 64 */
    state[ 0 ] += a;
    state[ 1 ] += b;
    state[ 2 ] += c;
    state[ 3 ] += d;
    }
   
    /* Encode鎶妉ong鏁扮粍鎸夐『搴忔媶鎴恇yte鏁扮粍錛屽洜涓簀ava鐨刲ong綾誨瀷鏄?4浣嶇殑錛屾墍浠ュ彧鎷嗕綆32浣嶏紝浠ラ傚簲鍘熷c瀹炵幇鐨勭敤閫?*/
    private void Encode( byte[] output, long[] input, int len)
    {
    int i, j;
    for( i = 0, j = 0; j < len; i ++, j += 4 )
    {
       output[ j ] = ( byte )( input[ i ] & 0xffL );
       output[ j + 1 ] = ( byte )( ( input[ i ] >>> 8 ) & 0xffL );
       output[ j + 2 ] = ( byte )( ( input[ i ] >>> 16 ) & 0xffL );
       output[ j + 3 ] = ( byte )( ( input[ i ] >>> 24 ) & 0xffL );
    }
    }
   
   /* Decode鎶奲yte鏁扮粍鎸夐『搴忓悎鎴恖ong鏁扮粍錛屽洜涓簀ava鐨刲ong綾誨瀷鏄?4浣嶇殑錛屽洜姝ゅ彧鍚堟垚浣?2浣嶏紝楂?2浣嶆竻闆?*/
    private void Decode( long[] output, byte[] input, int len )
    {
    int i, j;
    for( i = 0, j = 0; j < len; i ++, j += 4 )
    {
       output[ i ] = b2iu( input[ j ] ) |
        ( b2iu( input[ j + 1 ] ) << 8 ) |
        ( b2iu( input[ j + 2 ] ) << 16 ) |
        ( b2iu( input[ j + 3 ] ) << 24 );
    }
    }
   
    /* b2iu鏄竴涓檮鍔犵殑鎶奲yte鎸夌収涓嶈冭檻姝h礋鍙風殑鍘熷垯鐨?#8220;鍗囦綅”鍑芥暟錛屽洜涓簀ava娌℃湁unsigned榪愮畻 */
    public static long b2iu( byte b )
    {
    return b < 0 ? b & 0x7F + 128 : b;
    }
   
    /* byteHEX()鐢ㄦ潵鎶婁竴涓猙yte綾誨瀷鐨勬暟杞崲鎴愬崄鍏繘鍒剁殑ASCII琛ㄧず錛屽洜涓簍oString鏂規硶鏃犳硶鍋氬埌榪欎竴鐐?*/
    public static String byteHEX( byte ib )
    {
    char[] Digit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'D', 'E', 'F' };
    char[] ob = new char[ 2 ];
    ob[ 0 ] = Digit[ ( ib >>> 4 ) & 0x0F ];
    ob[ 1 ] = Digit[ ib & 0x0F ];
    String s = new String( ob );
    return s;
    }
   
    public static String toMD5( String source )
    {
    MD5 md5 = new MD5();
    return md5.getMD5ofStr( source );
    }
}



]]>
灝忔瘏鏀惰棌涔?-----JAVA鍔犲瘑瑙e瘑宸ュ叿綾?http://m.tkk7.com/xiaoyi/articles/278975.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Fri, 29 May 2009 17:49:00 GMThttp://m.tkk7.com/xiaoyi/articles/278975.htmlhttp://m.tkk7.com/xiaoyi/comments/278975.htmlhttp://m.tkk7.com/xiaoyi/articles/278975.html#Feedback0http://m.tkk7.com/xiaoyi/comments/commentRss/278975.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/278975.html闃呰鍏ㄦ枃

]]>
灝忔瘏鏀惰棌涔?-----浠嶫AR涓巣ip妗f鏂囦歡涓彁鍙朖ava 璧勬簮 http://m.tkk7.com/xiaoyi/articles/278972.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Fri, 29 May 2009 16:33:00 GMThttp://m.tkk7.com/xiaoyi/articles/278972.htmlhttp://m.tkk7.com/xiaoyi/comments/278972.htmlhttp://m.tkk7.com/xiaoyi/articles/278972.html#Feedback0http://m.tkk7.com/xiaoyi/comments/commentRss/278972.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/278972.html 澶氭暟 java 紼嬪簭鍛橀兘闈炲父娓呮浣跨敤 jar 鏂囦歡灝嗙粍鎴?/span> java 瑙e喅鏂規鐨勫悇縐嶈祫婧愶紙鍗?/span> .class 鏂囦歡銆佸0闊沖拰鍥懼儚錛夋墦鍖呯殑浼樼偣銆傚垰寮濮嬩嬌鐢?/span> jar 鏂囦歡鐨勪漢甯擱棶鐨勪竴涓棶棰樻槸錛?#8220;濡備綍浠?/span> jar 鏂囦歡涓彁鍙栧浘鍍忓憿錛?#8221;鏈枃灝嗗洖絳旇繖涓棶棰橈紝騫朵細鎻愪緵涓涓被錛岃繖涓被浣夸粠 jar 鏂囦歡涓彁鍙栦換浣曡祫婧愬彉寰楅潪甯哥畝鍗曪紒
鍔犺澆 gif 鍥懼儚
   
鍋囧畾鎴戜滑鏈変竴涓?/span> jar 鏂囦歡錛屽叾涓寘鍚垜浠殑搴旂敤紼嬪簭瑕佷嬌鐢ㄧ殑涓緇?/span> .gif 鍥懼儚銆備笅闈㈠氨鏄嬌鐢?/span> JarResources 璁塊棶 jar 鏂囦歡涓殑鍥懼儚鏂囦歡鐨勬柟娉曪細
    JarResources JR=new JarResources(" http://www.bt285.cn /GifBundle.jar");


    Image logo=Toolkit.getDefaultToolkit().createImage(JR.getResources("logo.gif"));

    
榪欐浠g爜璇存槑鎴戜滑鍙互鍒涘緩涓涓?/span>JarResources瀵硅薄錛屽茍灝嗗叾鍒濆鍖栦負鍖呭惈鎴戜滑瑕佷嬌鐢ㄧ殑璧勬簮鐨?/span> jar 鏂囦歡 -- images.jar銆傞殢鍚庢垜浠嬌鐢?/span>JarResources鐨?/span>getResource()鏂規硶灝嗘潵鑷?/span> logo.gif 鏂囦歡鐨勫師濮嬫暟鎹彁渚涚粰 awt Toolkit 鐨?/span>createImage()鏂規硶銆?/span>
鍛藉悕璇存槑
JarResource
鏄竴涓潪甯哥畝鍗曠殑紺轟緥錛屽畠璇存槑浜嗗浣曚嬌鐢?/span> java 鎵鎻愪緵鐨勫悇縐嶅姛鑳芥潵澶勭悊 jar 鍜?/span> zip 妗f鏂囦歡銆?/span>

 
宸ヤ綔鏂瑰紡

JarReources綾葷殑閲嶈鏁版嵁鍩熺敤鏉ヨ窡韙拰瀛樺偍鎸囧畾 jar 鏂囦歡鐨勫唴瀹癸細
public final class JarResources {

   public boolean debugon=false;

   private Hashtable htsizes=new Hashtable();
   private Hashtable htjarcontents=new Hashtable();

   private String jarfilename;

榪欐牱錛岃綾葷殑瀹炰緥鍖栬緗?/span> jar 鏂囦歡鐨勫悕縐幫紝鐒跺悗杞埌init()鏂規硶瀹屾垚鍏ㄩ儴瀹為檯宸ヤ綔銆?/span>
   public JarResources(String jarfilename) {
      this.jarfilename=jarfilename;
      init();
   }

鐜板湪錛?/span>init()鏂規硶鍙皢鎸囧畾 jar 鏂囦歡鐨勬暣涓唴瀹瑰姞杞藉埌涓涓?/span> hashtable錛堥氳繃璧勬簮鍚嶈闂級涓?/span>

     
榪欐槸涓涓浉褰撴湁鐢ㄧ殑鏂規硶錛屼笅闈㈡垜浠瀹冧綔榪涗竴姝ョ殑鍒嗘瀽銆?/span>ZipFile綾諱負鎴戜滑鎻愪緵浜嗗 jar/zip 妗f澶翠俊鎭殑鍩烘湰璁塊棶鏂規硶銆傝繖綾諱技浜庢枃浠剁郴緇熶腑鐨勭洰褰曚俊鎭備笅闈㈡垜浠垪鍑?/span>ZipFile涓殑鎵鏈夋潯鐩紝騫剁敤妗f涓瘡涓祫婧愮殑澶у皬娣誨厖 htsizes hashtable錛?/span>
 private void init() {
      try {
          // extracts just sizes only. 
          ZipFile zf=new ZipFile(jarFileName);
          Enumeration e=zf.entries();
          while (e.hasMoreElements()) {
              ZipEntry ze=(ZipEntry)e.nextElement();
              if (debugOn) {
                 System.out.println(dumpZipEntry(ze));
              }
              htSizes.put(ze.getName(),new Integer((int)ze.getSize()));
          }
          zf.close();
鎺ヤ笅鏉ワ紝鎴戜滑浣跨敤ZipInputStream綾昏闂。妗堛?/span>ZipInputStream綾誨畬鎴愪簡鍏ㄩ儴欖旀湳錛屽厑璁告垜浠崟鐙鍙栨。妗堜腑鐨勬瘡涓祫婧愩傛垜浠粠妗f涓鍙栫粍鎴愭瘡涓祫婧愮殑綺劇‘瀛楄妭鏁幫紝騫跺皢鍏跺瓨鍌ㄥ湪 htjarcontents hashtable 涓紝鎮ㄥ彲浠ラ氳繃璧勬簮鍚嶈闂繖浜涙暟鎹細     
          // extract resources and put them into the hashtable.
          FileInputStream fis=new FileInputStream(jarFileName);
          BufferedInputStream bis=new BufferedInputStream(fis);
          ZipInputStream zis=new ZipInputStream(bis);
          ZipEntry ze=null;
          while ((ze=zis.getNextEntry())!=null) {
             if (ze.isDirectory()) {
                continue;////鍟婂摕!娌℃湁澶勭悊瀛愮洰褰曚腑鐨勮祫婧愬晩 http://www.5a520.cn  灝忚520緗?/span>
             }
             if (debugOn) {
                System.out.println(
                   "ze.getName()="+ze.getName()+","+"getSize()="+ze.getSize()
                   );
             }
             int size=(int)ze.getSize();
             // -1 means unknown size. 
             if (size==-1) {
                size=((Integer)htSizes.get(ze.getName())).intValue();
             }
             byte[] b=new byte[(int)size];
             int rb=0;
             int chunk=0;
            while (((int)size - rb) > 0) {
                 chunk=zis.read(b,rb,(int)size - rb);
                 if (chunk==-1) {
                    break;
                 }
                 rb+=chunk;
             }
             // add to internal resource hashtable
             htJarContents.put(ze.getName(),b);
             if (debugOn) {
                System.out.println(
                   ze.getName()+" rb="+rb+
                   ",size="+size+
                   ",csize="+ze.getCompressedSize()
                   );
             }
          }
       } catch (NullPointerException e) {
          System.out.println("done.");
       } catch (FileNotFoundException e) {
          e.printStackTrace();
       } catch (IOException e) {
          e.printStackTrace();
       }
   }
璇鋒敞鎰忥紝鐢ㄦ潵鏍囪瘑姣忎釜璧勬簮鐨勫悕縐版槸妗f涓祫婧愮殑闄愬畾璺緞鍚嶏紝渚嬪錛?em>涓嶆槸鍖呬腑鐨勭被鍚?/span> -- 鍗?/span> java.util.zip 鍖呬腑鐨?/span>ZipEntry綾誨皢琚懡鍚嶄負 "java/util/zip/ZipEntry"錛岃屼笉鏄?/span> "java.util.zip.ZipEntry"銆?/span>

鍏跺畠鏂規硶:
    /**
    * Dumps a zip entry into a string.
    * @param ze a ZipEntry
    */
   private String dumpZipEntry(ZipEntry ze) {
       StringBuffer sb=new StringBuffer();
       if (ze.isDirectory()) {
          sb.append("d "); 
       } else {
          sb.append("f "); 
       }
       if (ze.getMethod()==ZipEntry.STORED) {
          sb.append("stored   "); 
       } else {
          sb.append("defalted ");
       }
       sb.append(ze.getName());
       sb.append("\t");
       sb.append(""+ze.getSize());
       if (ze.getMethod()==ZipEntry.DEFLATED) {
          sb.append("/"+ze.getCompressedSize());
       }
       return (sb.toString());
   }

    /**
    * Extracts a jar resource as a blob.
    * @param name a resource name.
    */
   public byte[] getResource(String name) {
      return (byte[])htJarContents.get(name);
   }
      
浠g爜鐨勬渶鍚庝竴涓噸瑕侀儴鍒嗘槸綆鍗曠殑嫻嬭瘯椹卞姩紼嬪簭銆傝嫻嬭瘯椹卞姩紼嬪簭鏄竴涓畝鍗曠殑搴旂敤紼嬪簭錛屽畠鎺ユ敹 jar/zip 妗f鍚嶅拰璧勬簮鍚嶃傚畠璇曞浘鍙戠幇妗f涓殑璧勬簮鏂囦歡錛岀劧鍚庡皢鎴愬姛鎴栧け璐ョ殑娑堟伅鎶ュ憡鍑烘潵錛?/span>
public static void main(String[] args) throws IOException {
       if (args.length!=2) {
          System.err.println(
             "usage: java JarResources < jar file name> < resource name>"
             );
          System.exit(1);
       }
       JarResources jr=new JarResources(args[0]);
       byte[] buff=jr.getResource(args[1]);
       if (buff==null) {
          System.out.println("Could not find "+args[1]+".");
       } else {
          System.out.println("Found "+args[1]+ " (length="+buff.length+").");
       }
   }
}              // End of JarResources class.
鎮ㄥ凡浜嗚В浜嗚繖涓被銆備竴涓槗浜庝嬌鐢ㄧ殑綾伙紝瀹冮殣钘忎簡浣跨敤鎵撳寘鍦?/span> jar 鏂囦歡涓殑璧勬簮鐨勫叏閮ㄦ鎵嬮棶棰樸?/span>
灝忕粨
濡傛灉鎮ㄦ浘緇忔復鏈涚煡閬撳浣曚粠 jar 鏂囦歡涓彁鍙栧浘鍍忥紝閭d箞鎮ㄧ幇鍦ㄥ凡瀛﹀埌浜嗕竴縐嶆柟娉曘傛湁浜嗘湰鎶宸ф彁渚涚殑榪欎釜鏂扮被錛屾偍灝變笉浠呭彲浠ョ敤 jar 鏂囦歡澶勭悊鍥懼儚錛岃屼笖鍙互灝嗘彁鍙栭瓟鏈敤浜?/span> jar 鏂囦歡涓殑浠諱綍璧勬簮銆?/span>


]]>
灝忔瘏鏀惰棌涔?-----------鍒╃敤Comparator鎺ュ彛瀹炵幇鏍規嵁List涓璞$殑灞炴ф帓搴?浠ュ墠紕板埌榪囷紝娌℃湁娣辯┒錛屾椂闂翠箙浜嗗繕浜嗐傛睏銆?http://m.tkk7.com/xiaoyi/articles/278224.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Wed, 27 May 2009 08:55:00 GMThttp://m.tkk7.com/xiaoyi/articles/278224.htmlhttp://m.tkk7.com/xiaoyi/comments/278224.htmlhttp://m.tkk7.com/xiaoyi/articles/278224.html#Feedback0http://m.tkk7.com/xiaoyi/comments/commentRss/278224.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/278224.htmlCollections.sort(fileList,   new   FileNodeComparator(form.getSortName(),form.isAsc()));   
    
    
    
  
class   FileNodeComparator   implements   Comparator{   
  
private   String   sortName   =   "name";   
  
private   boolean   isAsc   =   true;   
  FileNodeComparator(String   sortName,
boolean   isAsc){   
  
this.sortName   =   sortName;   
  
this.isAsc   =   isAsc;   
  }
   
  
public   int   compare(Object   arg0,   Object   arg1)   {   
  銆傘傘傘傘傘傘傘?nbsp;  
  銆傘傘傘傘傘傘傘?nbsp;  
  銆傘傘傘傘傘傘傘?nbsp;  
  銆傘傘傘傘傘傘傘?nbsp;  
  }
   
  }


]]>
灝忔瘏鏀惰棌涔?---------Java鍙嶅皠瀹炵幇綾諱技涓嶹inform涓鎵樼殑swing浜嬩歡澶勭悊http://m.tkk7.com/xiaoyi/articles/278124.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Tue, 26 May 2009 20:02:00 GMThttp://m.tkk7.com/xiaoyi/articles/278124.htmlhttp://m.tkk7.com/xiaoyi/comments/278124.htmlhttp://m.tkk7.com/xiaoyi/articles/278124.html#Feedback1http://m.tkk7.com/xiaoyi/comments/commentRss/278124.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/278124.html瀛︿範榪嘕ava Swing鐨勭▼搴忓憳涓瀹氬浜嶴wing涓浉瀵硅緝涓哄鏉傜殑浜嬩歡椹卞姩妯″瀷姣旇緝鍥版儜錛岃櫧鐒朵簨浠墮┍鍔ㄦā鍨嬪湪Java Swing涓瀹屽畬鍏ㄥ叏鐨勪綋鐜板嚭鏉ヤ簡錛屼絾鏄浜庝竴涓蔣浠跺垵瀛﹁呰岃█榪欐牱鐨勮繎涔?#8220;瑁鎬綋”鐨勪簨浠墮┍鍔ㄦā鍨嬬‘瀹炴槸寰堥毦鐞嗚В鐨勩?/p>

寰蔣鍏徃.Net妗嗘灦涓嶫ava Swing鐨凣UI緙栫▼鐩告瘮瑕佺畝鍗曞緢澶氾紝鍚屾牱鏄簨浠墮┍鍔ㄦā鍨?Net妗嗘灦灝辮繘琛屼簡澶ч噺鐨勫皝瑁呭鐞嗭紝.Net鎶婅繖縐嶅皝瑁呯О涔嬩負濮旀墭鍣?Delegate)錛屽叾浠g爜濡備笅錛?

 

//褰揵tnSubmit鎸夐挳琚偣鍑諱互鍚庤姹備氦緇檅tnSubmit_Click鏂規硶澶勭悊// EventHandler鍦ㄤ腑闂村惎鍒板鎵樺櫒鐨勪綔鐢紝//瀹冭礋璐e皢浜嬩歡鍒嗗彂鍒版寚瀹氱殑鏂規硶涓繘琛屽鐞唗his.btnSubmit.Click += new EventHandler(this.btnSubmit_Click);//浜嬩歡澶勭悊鏂規硶// object sender:浜嬩歡婧愶紝榪欓噷鎸嘼tnSubmit瀵硅薄// EventArgs e:浜嬩歡澶勭悊鍙傛暟錛屽畠淇濆瓨浜嗛渶瑕佹彁渚涚粰紼嬪簭鍛樼殑蹇呰淇℃伅private void btnSubmit_Click(object sender, EventArgs e){銆//鎵撳嵃This is a button璇彞銆System.Diagnostics.Debug.WriteLine("This is button");}

 

浣滀負瀵規瘮錛屾垜浠潵鐪嬬湅Java Swing鐨勪簨浠跺鐞嗗拰濮旀墭灝辮澶嶆潅寰堝浠g爜濡備笅錛?/p>

            

//涓篵tnSubmit澧炲姞渚﹀惉鍣⊿electHandler錛屽綋btnSubmit琚偣鍑諱互鍚?br /> //鏈変睛鍚櫒鐨刟ctionPerformed璐熻矗澶勭悊璇ョ偣鍑諱簨浠剁殑涓氬姟
//鐢變簬浜嬩歡婧恇tnSubmit鍜屼睛鍚櫒綾籗electHandler澶勪簬涓や釜涓嶅悓鐨勭被涓?br /> //涓轟簡璁㏒electHandler綾誨彇寰楅〉闈㈢殑淇℃伅錛屾垜浠渶瑕佸皢紿椾綋瀵硅薄(this)
//浼犲叆鍒頒睛鍚櫒涓?br /> btnSubmit.addActionListener(new SelectHandler(this));
//渚﹀惉鍣⊿electHandler錛屽畠蹇呴』瀹炵幇鍔ㄤ綔浜嬩歡ActionListener鎺ュ彛
//浠ヨ揪鍒頒簨浠跺垎鍙戠殑浣滅敤
class SelectHandler implements ActionListener {
銆private CommonDialogDemo form = null;
銆//灝嗙獥浣撳璞ommonDialogDemo閫氳繃鏋勯犲嚱鏁頒紶鍏electHandler綾諱腑
銆public SelectHandler(CommonDialogDemo form) {
this.form = form;
銆}
銆//浜嬩歡澶勭悊鏂規硶錛屽綋btnSubmit琚偣鍑伙紝鑷姩鎵ц浠ヤ笅鎵撳嵃浠g爜
銆publicvoid actionPerformed(ActionEvent e) {
System.out.println("This is button");
銆}
}

鏍規嵁浠ヤ笂浠g爜錛屾垜浠彲浠ユ竻鏅扮殑鐪嬪埌Java Swing瑕佹瘮.Net鐨勯夯鐑︾殑澶氾紝鑰屼笖鏇翠笉鑳借浜哄繊鍙楃殑灝辨槸錛屼竴涓〉闈㈠鏋滄湁澶氫釜鎸夐挳鐨勮瘽錛屾垜浠繀欏婚拡瀵規瘡涓寜閽紪鍐欏涓簨浠朵睛鍚被錛岃屼笖榪欎簺綾諱竴鑸兘浼氳璁句負鍐呴儴綾匯傚榪囪蔣浠跺緩妯$殑璇昏呭彲鑳界煡閬擄紝鍐呴儴杞歡寤烘ā鍦ㄨ蔣浠跺伐紼嬩腑鏄笉鎺ㄨ崘浣跨敤鐨勶紝鎵浠ヨ繖鏍風殑浠g爜緙栧啓鏄庢樉浼氬鍔犺璁″啑浣欏害鍜屽鏉傚害錛屽洜姝わ紝鎴戜滑鍙互鑰冭檻鑷繁緙栧啓涓涓被浼間簬.Net涓璄ventHandler涓鏍風殑浜嬩歡濮旀墭綾繪潵澶勭悊浜嬩歡鍒嗗彂銆?/p>

鐢變簬鎴戜滑鏃犳潈淇敼Java鐨勭紪璇戝櫒錛屾墍浠ユ垜鍦ㄨ繖閲屽皢浼氬熷姪浜庡弽灝勬妧鏈紝鍒╃敤涓涓簨浠跺鎵樼被澶勭悊鎵鏈夌殑鐐瑰嚮浜嬩歡錛屼唬鐮佸涓嬶細

            

package cn.softworks.teachersearchsystem.support;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.reflect.Method;

/**
*璇ョ被鏄敤鏉ュ鐞嗘墍鏈夌殑Swing鎸夐挳鐐瑰嚮浜嬩歡錛屽茍鏍規嵁灝嗗鐞嗘潈<br>
*杞氦緇欎嬌鐢ㄨ呮潵澶勭悊
*
*@authorChen.yu
*
*/
publicclass EventHandlerimplements ActionListener {

銆//緇勪歡鎵鍦ㄧ殑紿椾綋瀵硅薄
銆private Object form = null;

銆//鍙楀埌濮旀墭鐨勬柟娉曞悕
銆private String methodName = null;

銆/**
銆*鏋勯犲嚱鏁?br /> 銆*
*@paramform 緇勪歡鎵鍦ㄧ殑紿椾綋瀵硅薄
*@parammethodName 鍙楀埌濮旀墭鐨勬柟娉曞悕
銆*/
銆public EventHandler(Object form,String methodName) {
this.form = form;
this.methodName = methodName;
銆}

銆/**
銆*浜嬩歡澶勭悊濮旀墭鏂規硶
銆*/
銆publicvoid actionPerformed(ActionEvent e) {

//寰楀埌紿椾綋瀵硅薄鐨勭被鍨?br /> Class formType = this.form.getClass();

try {
銆//寰楀埌鎸囧畾濮旀墭鏂規硶鐨勭被鍨?
銆Method method =
formType.getMethod(this.methodName, new Class[] {e.getClass()});
銆//璋冪敤鎸囧畾鐨勬柟娉?br /> 銆method.invoke(this.form, new Object[] {e});

}catch(Exception ex) {
銆return;
}
銆}
}

鐜板湪鎴戜滑鏉ョ紪鍐欎竴涓祴璇曠▼搴忥紝浠g爜濡備笅錛?/p>

            

btnSearch.addActionListener(new EventHandler(this,"btnSearch_Click"));

public void btnSearch_Click(ActionEvent e) {
銆System.out.println("This is btnSearch");
}

浠庝互涓婁唬鐮佷腑鎴戜滑鍙互娓呮櫚鐨勭湅鍒幫紝浜嬩歡澶勭悊鍜屼簨浠跺鎵樺浜庡悓涓紿椾綋涓簡錛?Net鏂逛究鐨凞elegate澶勭悊琚垜浠敤鍙嶅皠瀹炵幇浜嗐?/p>

]]>
灝忔瘏鏀惰棌涔?---------鎴睆http://m.tkk7.com/xiaoyi/articles/272037.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Thu, 21 May 2009 09:21:00 GMThttp://m.tkk7.com/xiaoyi/articles/272037.htmlhttp://m.tkk7.com/xiaoyi/comments/272037.htmlhttp://m.tkk7.com/xiaoyi/articles/272037.html#Feedback0http://m.tkk7.com/xiaoyi/comments/commentRss/272037.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/272037.htmlpublic static void captureScreen(String fileName) throws Exception {

    Dimension screenSize 
= Toolkit.getDefaultToolkit().getScreenSize();
    Rectangle screenRectangle 
= new Rectangle(screenSize);
    Robot robot 
= new Robot();
    BufferedImage image 
= robot.createScreenCapture(screenRectangle);
    ImageIO.write(image, 
"png"new File(fileName));
}


]]>
jspmartLoad鏂囦歡涓婁紶涓嬭澆http://m.tkk7.com/xiaoyi/articles/232137.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Thu, 02 Oct 2008 15:16:00 GMThttp://m.tkk7.com/xiaoyi/articles/232137.htmlhttp://m.tkk7.com/xiaoyi/comments/232137.htmlhttp://m.tkk7.com/xiaoyi/articles/232137.html#Feedback0http://m.tkk7.com/xiaoyi/comments/commentRss/232137.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/232137.html 

姝や緥瀛愭槸鍩轟簬jspsmartupload緇勪歡鐨勶紝jspsmartupload鏄竴涓笉閿欑殑涓婁紶涓嬭澆緇勪歡錛屼絾瀵逛腑鏂囨敮鎸佷笉瓚熾傝嫢涓嬭澆鐨勬枃浠跺悕涓湁姹夊瓧錛屽垯嫻忚鍣ㄥ湪鎻愮ず鍙﹀瓨鐨勬枃浠跺悕鏃訛紝鏄劇ず鐨勬槸涓鍫嗕貢鐮侊紝璁╀漢鐪嬩簡寰堜笉鑸掓湇錛屼負姝わ紝鏈変漢涓撻棬淇敼姝ょ粍浠訛紝鍋氫簡緙栫爜鐨勮漿鎹㈠伐浣滐紝灝嗘枃浠跺悕杞崲涓篣TF-8褰㈠紡鐨勭紪鐮佸艦寮忋傛垜鐢ㄧ殑鏄綉涓婁慨鏀硅繃鐨勶紝宸茬粡鍙互鏀寔涓枃錛岀浉淇′綘涔熷彲浠ユ壘鍒幫紝濡傛灉闇瑕侊紝鍙互鑱旂郴鎴戯紝鎴戜細鍦ㄧ涓鏃墮棿鍙戠粰浣狅紒

鍦ㄧ綉涓婃壘浜嗗緢澶氱浉鍏寵祫鏂欙紝鑷繁涔熸坊鍔犱簡涓浜沯s浠g爜錛屽熀鏈疄鐜頒簡鍔ㄦ佹坊鍔犲垹闄ゅ鏂囦歡涓婁紶鐨勫姛鑳斤紝濡傛灉鎯寵鍋氬緱鏇村畬緹庯紝鎴栬呮妸鏂囦歡涓婁紶涓嬭澆淇℃伅瀛樺偍鍒版暟鎹簱絳夛紝閭e氨鑷繁鍘誨畬鍠勪簡錛屼互涓嬫槸鎵鏈夌殑婧愪唬鐮侊細

(鏂囦歡涓嬭澆鍑轟簬瀹夊叏鑰冭檻鏄寜嫻佺殑鏂瑰紡鏉ヨ繘琛岀殑錛岃屼笉鏄洿鎺ョ粰鍑烘枃浠朵笅杞借礬寰勫湴鍧錛屾墍浠ュ儚榪呴浄絳変笅杞藉伐鍏鋒槸涓嶈兘涓嬭澆鐨?

棣栧厛褰撶劧鏄笂浼犱笅杞界殑欏甸潰浜嗭紝upfile.jsp

<%@ page contentType="text/html;charset=GBK"%>
<html>
<head>
   
<title>File Upload</title>
<script type="text/javascript">
         function addFile()
        {
            var upFile = '
<input type="file" name="file1"><br>';
            document .getElementById ("files").insertAdjacentHTML("beforeEnd",upFile);
        }
        function deleteFile()
        {
            var file = document .getElementById ("files").lastChild;
            if(file == null)
                return;
            document .getElementById ("files").removeChild(file);
            
            file = document .getElementById ("files").lastChild;   //縐婚櫎鎹㈣絎?/span><br>鎵浠ヨ縐諱袱嬈?br />             document .getElementById ("files").removeChild(file); //濡傛灉鍦ㄨ〃鏍奸噷闈笉鍔?/span><br>灝辮嚜鍔ㄦ崲琛岀殑錛屽彲浠ュ幓鎺夛紝鑷繁鎶婃彙
        }
</script>
</head>
<body>
<h3>鍩轟簬jspsmart upload緇勪歡鐨勬枃浠朵笂浼犱笅杞?/span></h3>
<form action="servlet/ServletUpload" method="post" enctype="multipart/form-data">
   閫夋嫨鏂囦歡錛?/span><div id="files"><input type="file" name="file1"><br></div>
     
<input type="submit" value="涓婁紶">
     
<input type="button" value="澧炲姞鏂囦歡" onclick="addFile()"> 
     
<input type="button" value="鍒犻櫎鏂囦歡" onclick="deleteFile()">
     
<input type="reset" value="閲嶇疆">
   
</form>
   
<br>
   
<form action="servlet/ServletDownload" method="post">
     涓嬭澆鏂囦歡鐨勫悕縐幫細
     
<input type="text" name="downloadFileName" size="20" maxlength="80">
    
<input type="submit" value="涓嬭澆">
   
</form>
</body>
</html>
鐒跺悗鏄疄鐜頒笂浼犲拰涓嬭澆鐨勪袱涓猻ervlet綾?br />
涓婁紶鏂囦歡ServletUpload綾伙細

package servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jspsmart.upload.SmartUpload;
import com.jspsmart.upload.SmartUploadException;

public class ServletUpload extends HttpServlet {

private ServletConfig config;

public ServletUpload() {
   super();
}

public void destroy() {
   super.destroy(); // Just puts "destroy" string in log
}

public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException { 
   int count = 0; //璁板綍鏂囦歡涓婁紶鎬諱釜鏁?br />    SmartUpload mySmartUpload = new SmartUpload();
   mySmartUpload.initialize(config,request, response);
   try {
    //mySmartUpload.setAllowedFilesList("rar,htm,html,jar");//璁劇疆鍏佽涓婁紶鐨勬枃浠?br />     mySmartUpload.setDeniedFilesList("exe,jsp,asp");//紱佹涓婁紶鐨勬枃浠?br />     mySmartUpload.setDenyPhysicalPath(true); //鎷掔粷鐗╃悊璺緞
    mySmartUpload.setMaxFileSize(5000000);//璁劇疆鍏佽涓婁紶鏂囦歡鏈澶т負50000bytes
    mySmartUpload.setTotalMaxFileSize(50000000);//涓嬈′笂浼犳枃浠跺ぇ灝忔渶澶氫笉瓚呰繃5000000bytes
    mySmartUpload.upload();
    for(int i=0;i
<mySmartUpload.getFiles().getCount();i++){
     com.jspsmart.upload.File myFile 
= mySmartUpload.getFiles().getFile(i);
     
String fileName = myFile.getFileName();
     
System.out.println("鏂囦歡鍚嶏細"+fileName);
    }
    count 
= mySmartUpload.save("/upload");
    
System.out.println(count+"鏂囦歡宸蹭笂浼?);
   } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
   doGet(request, response);
}

public void init(ServletConfig config) throws ServletException {
   this.config 
= config;
}
}

涓嬭澆鏂囦歡ServletDownload綾伙細

package servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jspsmart.upload.SmartUpload;
import com.jspsmart.upload.SmartUploadException;

public class ServletDownload extends HttpServlet {

private ServletConfig config;

public ServletDownload() {
   super();
}

public void destroy() {
   super.destroy(); // Just puts "destroy" string in log
}

public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
   String temp_fileName 
= request.getParameter("downloadFileName");
   
if(temp_fileName == null || temp_fileName == "")
    return ;
   byte[] temp_t 
= temp_fileName.getBytes("ISO8859_1");
   
String fileName = new String(temp_t, "GBK");
   SmartUpload mySmartUpload 
= new SmartUpload();
   mySmartUpload.initialize(config, request, response);
   mySmartUpload.setContentDisposition(null);
   /*
   * 鍘熷瀷錛歱ublic void setContentDisposition(String contentDisposition)
   * 鍏朵腑錛宑ontentDisposition涓鴻娣誨姞鐨勬暟鎹?br />    * 濡傛灉contentDisposition涓簄ull錛屽垯緇勪歡灝嗚嚜鍔ㄦ坊鍔?attachment;"錛?br />    * 浠ヨ〃鏄庡皢涓嬭澆鐨勬枃浠朵綔涓洪檮浠訛紝緇撴灉鏄疘E嫻忚鍣ㄥ皢浼氭彁紺哄彟瀛樻枃浠訛紝鑰屼笉鏄嚜鍔ㄦ墦寮榪欎釜鏂囦歡
   * 錛圛E嫻忚鍣ㄤ竴鑸牴鎹笅杞界殑鏂囦歡鎵╁睍鍚嶅喅瀹氭墽琛屼粈涔堟搷浣滐紝鎵╁睍鍚嶄負doc鐨勫皢鐢╳ord紼嬪簭鎵撳紑錛?br />    * 鎵╁睍鍚嶄負pdf鐨勫皢鐢╝crobat紼嬪簭鎵撳紑錛岀瓑絳夛級銆?br />    */
   try {
    mySmartUpload.downloadFile("/upload/"+fileName);
   
   } catch (SmartUploadException e) {
    e.printStackTrace();
   }
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
   doGet(request, response);
}

public void init(ServletConfig config) throws ServletException {
   this.config 
= config;
}
}

浠ヤ笅鏄痺eb.xml閰嶇疆鏂囦歡:

<?xml version
="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
xmlns
="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation
="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>
<servlet>
    
<description>This is the description of my J2EE component</description>
    
<display-name>This is the display name of my J2EE component</display-name>
    
<servlet-name>ServletUpload</servlet-name>
    
<servlet-class>servlet.ServletUpload</servlet-class>
</servlet>
<servlet>
    
<description>This is the description of my J2EE component</description>
    
<display-name>This is the display name of my J2EE component</display-name>
    
<servlet-name>ServletDownload</servlet-name>
    
<servlet-class>servlet.ServletDownload</servlet-class>
</servlet>


<servlet-mapping>
    
<servlet-name>ServletUpload</servlet-name>
    
<url-pattern>/servlet/ServletUpload</url-pattern>
</servlet-mapping>
<servlet-mapping>
    
<servlet-name>ServletDownload</servlet-name>
    
<url-pattern>/servlet/ServletDownload</url-pattern>
</servlet-mapping>
<welcome-file-list>
    
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

瑕佸疄鐜版棤鍒鋒柊涓婁紶鍏跺疄寰堢畝鍗曘傚彧瑕佸埄鐢╥frame鍗沖彲錛屽彧瑕佹妸target璁劇疆涓洪殣钘忕殑iframe灝嗗氨鍙互浜嗐?br />  錛渋frame name='hidden_frame' id="hidden_frame" style='display:none'錛烇紲/iframe錛?/span>

]]>
灝忚娉涘瀷http://m.tkk7.com/xiaoyi/articles/230494.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Mon, 22 Sep 2008 11:25:00 GMThttp://m.tkk7.com/xiaoyi/articles/230494.htmlhttp://m.tkk7.com/xiaoyi/comments/230494.htmlhttp://m.tkk7.com/xiaoyi/articles/230494.html#Feedback0http://m.tkk7.com/xiaoyi/comments/commentRss/230494.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/230494.html娉涘瀷
涓銆佷粈涔堟槸娉涘瀷錛?
閫氳繃娉涘瀷鍙互瀹氫箟綾誨瀷瀹夊叏綾伙紝鑰屼笉浼氭崯瀹崇被鍨嬪畨鍏ㄣ佹ц兘鎴栧伐浣滄晥鐜?

浜屻佸疄渚嬪寲娉涘瀷
1銆佸彲浠ヤ嬌鐢ㄤ換浣曠被鍨嬫潵澹版槑鍜屽疄渚嬪寲
2銆佺敵鏄庡拰瀹炰緥璇濋兘蹇呴』鐢ㄤ竴涓壒瀹氱殑綾誨瀷鏉ヤ唬鏇夸竴鑸被鍨婽
3銆佷緥瀛愶細
//鍘熸潵鍐欐硶
Public   class   Stack
{
object[]   m_Items;
public   void   Push(object   item)
{...}
public   object   Pop()
{...}
}
Stack   stack   =   new   Stack();
stack.Push(1);
int   number   =   (int)stack.Pop();

//鏈変簡娉涘瀷鍚?
Public   class   Stack <T>
{
T[]   m_Items;
public   void   Push(T   item)
{...}
public   T   Pop()
{...}
}
Stack <int>   stack   =   new   Stack <int> ();
stack.Push(1);
int   number   =   (int)stack.Pop();

涓夛細娉涘瀷鐨勫ソ澶?
1銆佷竴嬈℃х殑寮鍙戙佹祴璇曞拰閮ㄧ講浠g爜錛岄氳繃浠諱綍綾誨瀷鏉ラ噸鐢ㄥ畠
2銆佺紪璇戝櫒鏀寔鍜岀被鍨嬪畨鍏?
3銆佷笉浼氬己琛屽鍊肩被鍨嬭繘琛岃綆卞拰鍙栨秷瑁呯錛屾垨鑰呭寮曠敤綾誨瀷榪涜鍚戜笅寮哄埗綾誨瀷杞崲錛屾墍浠ユц兘寰楀埌鏄捐憲鎻愰珮銆?
娉細鍊肩被鍨嬪ぇ姒傚彲浠ユ彁楂?00%錛屽紩鐢ㄧ被鍨嬪ぇ姒備負100%

鍥涳細澶氫釜娉涘瀷
1銆佸崟涓被鍨嬪彲浠ュ畾涔夊涓硾鍨?

浜旓細娉涘瀷鍒悕
1銆佸湪鏂囦歡澶撮儴浣跨敤using   涓虹壒瀹氱被鍨嬪彇鍒悕錛屽埆鍚嶄綔鐢ㄨ寖鍥存槸鏁翠釜鏂囦歡
2銆佷緥瀛?
using   List   =   LinkedList <int,string> ;
class   ListClient
{
static   void   Main(string[]   args)
{
List   list   =   new   List();
list.AddHead(123, "AAA ");
}
}

浜旓細娉涘瀷綰︽潫
(1)銆佹淳鐢熺害鏉?
濡傦細
public   class   LinkedList <K,T>   where   K:IComparable
{
T   Find(K   key)
{
if   (str.Key.CompareTo(key)   ==   0)//鍙湁瀹炵幇榪欎釜鎺ュ彛鎵嶅彲姣旇緝
}
}

娉ㄦ剰:
1銆佹墍鏈夌殑媧劇敓綰︽潫蹇呴』鏀懼湪綾葷殑瀹為檯媧劇敓鍒楄〃涔嬪悗
濡傦細public   class   LinkedList <K,T> :IEnumerable <T>   where   K:IComparable <K>
        {...}
2銆佷竴涓硾鍨嬪弬鏁頒笂鍙互綰︽潫澶氫釜鎺ュ彛錛堢敤閫楀彿鍒嗛殧錛?
public   class   LinkedList <K,T>   where   K:IComparable <K> ,IConvertible
3銆佸湪涓涓害鏉熶腑鏈澶氬彧鑳戒嬌鐢ㄤ竴涓熀綾?
4銆佺害鏉熺殑鍩虹被涓嶈兘鏄瘑灝佺被鎴栭潤鎬佺被
5銆佷笉鑳藉皢System.Delegate鎴朣ystem.Array綰︽潫涓哄熀綾?
6銆佸彲浠ュ悓鏃剁害鏉熶竴涓熀綾諱互鍙婁竴涓垨澶氫釜鎺ュ彛錛屼絾鏄鍩虹被蹇呴』棣栧厛鍑虹幇鍦ㄦ淳鐢熺害鏉熷垪琛ㄤ腑銆?
7銆丆#鍏佽浣犲皢鍙︿竴涓硾鍨嬪弬鏁版寚瀹氫負綰︽潫
public   class   MyClass <T,U>   where   T:U
{...}
8銆佸彲浠ヨ嚜宸卞畾涔夊熀綾繪垨鎺ュ彛榪涜娉涘瀷綰︽潫
9銆佽嚜瀹氫箟鐨勬帴鍙f垨鍩虹被蹇呴』涓庢硾鍨嬪叿鏈変竴鑷寸殑鍙鎬?

(2)銆佹瀯閫犲嚱鏁扮害鏉?
濡傦細
class   Node   <K,T>   where   T:new()
{
}
娉ㄦ剰錛?
1銆佸彲浠ュ皢鏋勯犲嚱鏁扮殑綰︽潫鍜屾淳鐢熺害鏉熺粨鍚堣搗鏉ワ紝鍓嶆彁鏄瀯閫犲嚱鏁扮殑綰︽潫鍑虹幇鍦ㄧ害鏉熷垪琛ㄤ腑鐨勬渶鍚?

(3)銆佸紩鐢?鍊肩被鍨嬬害鏉?
1銆佸彲浠ヤ嬌鐢╯truct綰︽潫灝嗘硾鍨嬪弬鏁扮害鏉熶負鍊肩被鍨?濡俰nt銆乥ool銆乪num),鎴栦換浣曡嚜瀹氫箟緇撴瀯
2銆佸悓鏍峰彲浠ヤ嬌鐢╟lass綰︽潫灝嗘硾鍨嬪弬鏁扮害鏉熶負寮曠敤綾誨瀷
3銆佷笉鑳藉皢寮曠敤/鍊肩被鍨嬬害鏉熶笌鍩虹被綰︽潫涓璧蜂嬌鐢紝鍥犱負鍩虹被綰︽潫娑夊強鍒扮被
4銆佷笉鑳戒嬌鐢ㄧ粨鏋勫拰榛樿鏋勯犲嚱鏁扮害鏉燂紝鍥犱負榛樿鏋勯犲嚱鏁扮害鏉熶篃娑夊強鍒扮被
5銆佽櫧鐒舵偍鍙互浣跨敤綾誨拰榛樿鏋勯犲嚱鏁扮害鏉燂紝浣嗘槸榪欐牱鍋氭病鏈変換浣曚環鍊?
6銆佸彲浠ュ皢寮曠敤/鍊肩被鍨嬬害鏉熶笌鎺ュ彛綰︽潫緇勫悎璧鋒潵錛屽墠鎻愭槸寮曠敤/鍊肩被鍨嬬害鏉熷嚭鐜板湪綰︽潫鍒楄〃鐨勫紑澶?

鍏細娉涘瀷鍜屽己鍒剁被鍨嬭漿鎹?
1銆丆#緙栬瘧鍣ㄥ彧鍏佽灝嗘硾鍨嬪弬鏁伴殣寮忚漿鎹㈠埌Object鎴栫害鏉熸寚瀹氱殑綾誨瀷
濡傦細
interface   IS{...}
class   BaseClass{...}
class   MyClass <T>   where   T:BaseClass,IS
{
void   SomeMethod(T   t)
{
IS   obj1   =   t;
BaseClass   obj2   =   t;
object   obj3   =   t;
}
}
2銆佺紪璇戝櫒鍏佽浣犲皢娉涘瀷鍙傛暟鏄劇ず寮哄埗杞崲鍒板叾浠栦換浣曞熷彛錛屼絾涓嶈兘灝嗗叾杞崲鍒扮被
interface   IS{...}
class   SomeClass{...}
class   MyClass   <T>   //娌℃湁綰︽潫
{
void   SomeMethod(T   t)
{
IS   obj1   =   (IS)t;   //鍙互
SomeClass   obj2   =   (SomeClass)t   //涓嶅彲浠?
}
}
3銆佸彲浠ヤ嬌鐢ㄤ復鏃剁殑Object鍙橀噺錛屽皢娉涘瀷鍙傛暟寮哄埗杞崲鍒板叾浠栦換浣曠被鍨?
class   SomeClass{...}
class   MyClass   <T>  
{
void   SomeMethod(T   t)
{
object   temp   =   t;
SomeClass   obj   =   (SomeClass)temp;//鍙互
}
}
娉ㄦ剰錛氳繖閲屽彧鏄憡璇変綘榪欐牱鍐欐槸鍙互鐨勶紝浣嗘槸瑕佷笉瑕佽繖鏍峰啓錛熶笉瑕佽繖鏍峰啓錛屽洜涓哄鏋渢紜疄娌℃湁緇ф壙SomeClass緙栬瘧娌¢敊浣嗘槸榪愯灝變細鍑洪敊
4銆佽В鍐充笂闈㈠己鍒惰漿鎹㈤棶棰橈紝鍙互浣跨敤is鍜宎s榪愮畻絎﹁繘琛屽垽鏂?
public   class   MyClass <T>
{
public   void   SomeMethod <T   t>
{
if   (t   is   int   ){...}
if   (t   is   LinkedList <int,string> ){...}
//濡傛灉娉涘瀷鍙傛暟鐨勭被鍨嬫槸鎵鏌ヨ鐨勭被鍨嬶紝鍒檌s榪愮畻絎﹁繑鍥瀟rue
string   str   =   t   as   string;
//濡傛灉榪欏啓綾誨瀷鍏煎錛屽垯as灝嗘墽琛屽己鍒剁被鍨嬭漿鎹紝鍚﹀垯灝嗚繑鍥瀗ull
if   (str   !=   null){...}
LinkedList <int,string>   list   =   t   as   LinkedList <int,string> ;
if   (list   !=   null){...}
}
}

涓冿細緇ф壙鍜屾硾鍨?
1銆佸湪浠庢硾鍨嬪熀綾繪淳鐢燂紝鍙互鎻愪緵綾誨瀷瀹炲弬錛岃屼笉鏄熀綾繪硾鍨嬪弬鏁?
public   class   BaseClass <T> {...}
public   class   SubClass:BaseClass <int>
2銆佸鏋滃瓙綾繪槸娉涘瀷錛岃岄潪鍏蜂綋鐨勭被鍨嬪疄鍙傦紝鍒欏彲浠ヤ嬌鐢ㄥ瓙綾繪硾鍨嬪弬鏁頒綔涓烘硾鍨嬪熀綾葷殑鎸囧畾綾誨瀷
public   class   BaseClass <TT> {...}
public   class   SubClass <T> :BaseClass <T> {...}
3銆佸湪浣跨敤瀛愮被娉涘瀷鍙傛暟鏃訛紝蹇呴』鍦ㄥ瓙綾葷駭鍒噸澶嶅湪鍩虹被綰у埆瑙勫畾鐨勪換浣曠害鏉?
4銆佸熀綾誨彲浠ュ畾涔夊叾絳懼悕浣跨敤娉涘瀷鍙傛暟鐨勮櫄紺兼柟娉曪紝鍦ㄩ噸鍐欏畠浠椂錛屽瓙綾誨繀欏誨湪鏂規硶絳懼悕涓彁渚涚浉搴旂殑綾誨瀷銆?
濡傦細
public   class   BaseClass <T>
{
public   virtual   T   SomeMethod()
{...}
}
public   class   SubClass:BaseClass <int>
{
public   override   int   SomeMethod()
{...}
}
5銆佸鏋滆瀛愮被鏄硾鍨嬶紝鍒欏畠榪樺彲浠ュ湪閲嶅啓鏃朵嬌鐢ㄥ畠鑷繁鐨勬硾鍨嬪弬鏁?
public   class   SubClass <T> :BaseClass <T>
{
public   override   T   SomeMethod()
{...}
}
6銆佷綘鍙互瀹氫箟娉涘瀷鎺ュ彛銆佹硾鍨嬫娊璞$被錛岀敋鑷蟲硾鍨嬫娊璞℃柟娉曘?
7銆佷笉鑳藉娉涘瀷鍙傛暟浣跨敤+鎴?=涔嬬被鐨勮繍綆楃
public   class   Calculator <T>
{
public   T   Add   (T   arg1,T   arg2)
{
return   arg1   +   arg2;//閿欒
}
}
浣嗘槸鎴戜滑鍙互閫氳繃娉涘瀷鎶借薄綾匯佹帴鍙f潵瀹炵幇鍦ㄤ釜鍔熻兘錛屽洜涓哄疄鐜版硾鍨嬫娊璞$被銆佹帴鍙f垜浠氨宸茬粡鏄庣‘浼犱竴涓弬鏁頒簡錛屽氨鍙互鎵ц璇稿+榪欐牱鐨勬搷浣溿?

鍏細娉涘瀷鏂規硶
1銆佹柟娉曞彲浠ュ畾涔夌壒瀹氫簬鍏舵墽琛岃寖鍥寸殑娉涘瀷鍙傛暟
public   class   MyClass <T>
{
public   void   MyMethod <X> (X   x)
{...}
}
2銆佸嵆浣垮悇鍖呭惈綾繪牴鏈笉浣跨敤娉涘瀷錛屼綘涔熷彲浠ュ畾涔夋柟娉曠壒瀹氱殑娉涘瀷鍙傛暟
public   class   MyClass
{
public   void   MyMethod <T> (T   t)
{...}
}
娉ㄦ剰錛氳鍔熻兘鍙嬌鐢ㄤ簬鏂規硶錛屽睘鎬э紝绱㈠紩鍣ㄥ彧鑳戒嬌鐢ㄥ湪綾葷殑浣滅敤鑼冨洿涓畾涔夌殑娉涘瀷鍙傛暟銆?
3銆佽皟鐢ㄦ硾鍨嬫柟娉?
MyClass   obj   =   new   MyClass();
obj.MyMethod <int> (3);
涔熷彲浠ヨ繖鏍鳳細
MyClass   obj   =   new   MyClass();
obj.MyMethod(3);   //璇ュ姛鑳界О涓烘硾鍨嬫帹鐞?
4銆佹硾鍨嬫柟娉曚篃鍙互鏈夎嚜宸辯殑娉涘瀷鍙傛暟綰︽潫
pubic   class   MyClass
{
public   void   SomeMethod <T> (T   t)   where   T:IComparable <T>
{...}
}
5銆佸瓙綾繪柟娉曞疄鐜頒笉鑳介噸澶嶅湪鐖剁駭鍒嚭鐜扮殑綰︽潫
public   class   BaseClass
{
public   virtual   void   SomeMethod <T> (T   t)where   T:new()
{...}
}
pubic   class   SubClass:BaseClass
{
public   override   void   SomeMethod <T> (T   t)//涓嶈兘鍐嶆湁綰︽潫
{...}
}
6銆侀潤鎬佹柟娉?
闈欐佹柟娉曞彲浠ュ畾涔夌壒瀹氱殑娉涘瀷鍙傛暟鍜岀害鏉?
public   class   MyClass <T>
{
public   static   T   SomeMethod <X> (T   t,X   x)
{...}
}
int   number   =   MyClass <int> .SomeMethod <string> (3, "AAA ");
鎴栬咃細int   mumber   =   MyClass <int> .SomeMethod(3, "AAA ");

涔濓細娉涘瀷濮旀墭
1銆佸湪鏌愪釜綾諱腑瀹氫箟鐨勫鎵樺彲浠ュ埄鐢ㄨ綾葷殑娉涘瀷鍙傛暟
2銆佸鎵樹篃鍙互瀹氫箟鑷繁鐨勬硾鍨嬪弬鏁?/strong>

]]>
灝忔瘏鐨勯獙璇佺爜http://m.tkk7.com/xiaoyi/articles/228185.html鍙埍鐨勫皬姣?/dc:creator>鍙埍鐨勫皬姣?/author>Wed, 10 Sep 2008 08:42:00 GMThttp://m.tkk7.com/xiaoyi/articles/228185.htmlhttp://m.tkk7.com/xiaoyi/comments/228185.htmlhttp://m.tkk7.com/xiaoyi/articles/228185.html#Feedback0http://m.tkk7.com/xiaoyi/comments/commentRss/228185.htmlhttp://m.tkk7.com/xiaoyi/services/trackbacks/228185.htmlcheckCode.java
package com.yz.checkcode;

import java.io.IOException;    
import java.io.PrintWriter;

import javax.servlet.ServletException;    
import javax.servlet.ServletOutputStream;    
   
import javax.servlet.http.HttpServlet;    
import javax.servlet.http.HttpServletRequest;    
import javax.servlet.http.HttpServletResponse;    
import javax.servlet.http.HttpSession;    
   
import com.sun.image.codec.jpeg.JPEGCodec;    
import com.sun.image.codec.jpeg.JPEGImageEncoder;    
   
import java.awt.*;    
import java.awt.image.*;    
import java.util.*;    
   
public class checkCode    
    extends HttpServlet {    
   
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws   
       ServletException, IOException {    
     response.reset();    
     response.setContentType("image/jpeg");    
     response.setHeader("Pragma","No-cache");
     response.setHeader("Cache-Control","no-cache");
     response.setHeader("Expires",   "Tues,   01   Jan   1980   00:00:00   GMT");   
    
   
//鍦ㄥ唴瀛樹腑鍒涘緩鍥捐薄    
    int width = 58, height = 18;    
     BufferedImage image = new BufferedImage(width, height,    
                                             BufferedImage.TYPE_INT_RGB);    
   
//鑾峰彇鍥懼艦涓婁笅鏂?nbsp;   
     Graphics g = image.getGraphics();    
   
//鐢熸垚闅忔満綾?nbsp;   
     Random random = new Random();    
   
//璁懼畾鑳屾櫙鑹?nbsp;   
     g.setColor(new Color(201 + random.nextInt(50), 201 + random.nextInt(50),    
                         201 + random.nextInt(50)));    
     g.fillRect(0, 0, width, height);    
   
//璁懼畾瀛椾綋    
     g.setFont(new Font("Times new Roman", Font.PLAIN, 18));    
   
//鐢昏竟妗?nbsp;   
g.setColor(new Color(255,140,0));    
g.drawRect(0,0,width-1,height-1);    
   
//闅忔満浜х敓155鏉″共鎵扮嚎錛屼嬌鍥捐薄涓殑璁よ瘉鐮佷笉鏄撹鍏跺畠紼嬪簭鎺㈡祴鍒?nbsp;   
     g.setColor(new Color(160 + random.nextInt(41), 160 + random.nextInt(41),    
                         160 + random.nextInt(41)));    
    for (int i = 0; i 
< 155
; i++) {    
      int x 
= random.nextInt(width);    
      
int y 
= random.nextInt(height);    
      
int xl 
= random.nextInt(12);    
      
int yl 
= random.nextInt(12);    
       
g.drawLine(x, y, x + xl, y + yl);    
     }    
   
//鍙栭殢鏈轟駭鐢熺殑璁よ瘉鐮?br />     String src 
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ0123456789"
;
     String sRand 
= ""
;    
    for (int i 
= 0; 
i < 4; i++) {    
        int position
=random.nextInt(src.length());
        
String radomChar
=src.charAt(position)+"";
       
sRand +
= radomChar;    
   
//灝嗚璇佺爜鏄劇ず鍒板浘璞′腑    
       g.setColor(new Color(20 + random.nextInt(111), 20 + random.nextInt(111),    
                           20 + random.nextInt(111)));    
   
//璋冪敤鍑芥暟鍑烘潵鐨勯鑹茬浉鍚岋紝鍙兘鏄洜涓虹瀛愬お鎺ヨ繎錛屾墍浠ュ彧鑳界洿鎺ョ敓鎴?nbsp;   
       g.drawString(  radomChar, 13 * i + 6, 16);    
     }    
    
//鍥捐薄鐢熸晥    
     g.dispose(); 
     HttpSession session 
= request.getSession(true);  
     
     
//灝嗚璇佺爜瀛樺叆SESSION    
      session.setAttribute("checkCode", sRand);
   
//杈撳嚭鍥捐薄鍒伴〉闈?nbsp;    
     ServletOutputStream out 
= response.getOutputStream();    
     
JPEGImageEncoder encoder 
= JPEGCodec.createJPEGEncoder(out);    
     
encoder.encode(image);    
     System.out.println("楠岃瘉鐮侊細\t"+sRand);
     out.println(sRand);
     out.flush();
     out.close();
   }    
}    

getKey.java
package com.yz.checkcode;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class getKey extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.doPost(request, response);
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        response.setContentType("text/html");
        response.setCharacterEncoding("utf-8");
        PrintWriter out = response.getWriter();    
        String key=request.getSession().getAttribute("checkCode").toString();
        out.println(key);
        out.flush();
        out.close();
    }
}


]]>
灝忔瘏灝忚Java瀛楃涓?/title><link>http://m.tkk7.com/xiaoyi/articles/224118.html</link><dc:creator>鍙埍鐨勫皬姣?/dc:creator><author>鍙埍鐨勫皬姣?/author><pubDate>Mon, 25 Aug 2008 04:22:00 GMT</pubDate><guid>http://m.tkk7.com/xiaoyi/articles/224118.html</guid><wfw:comment>http://m.tkk7.com/xiaoyi/comments/224118.html</wfw:comment><comments>http://m.tkk7.com/xiaoyi/articles/224118.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/xiaoyi/comments/commentRss/224118.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/xiaoyi/services/trackbacks/224118.html</trackback:ping><description><![CDATA[<strong>棣栧厛鎴戜滑鏉ョ湅浠ヤ釜灝忎緥瀛愶細<br /> </strong> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><strong><img id="Codehighlighter1_18_200_Open_Image" onclick="this.style.display='none'; Codehighlighter1_18_200_Open_Text.style.display='none'; Codehighlighter1_18_200_Closed_Image.style.display='inline'; Codehighlighter1_18_200_Closed_Text.style.display='inline';" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_18_200_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_18_200_Closed_Text.style.display='none'; Codehighlighter1_18_200_Open_Image.style.display='inline'; Codehighlighter1_18_200_Open_Text.style.display='inline';" src="http://m.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" alt="" /><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">class</span><span style="color: #000000"> Test </span><span id="Codehighlighter1_18_200_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span></strong><span id="Codehighlighter1_18_200_Open_Text"><strong><span style="color: #000000">{<br /> <img id="Codehighlighter1_62_84_Open_Image" onclick="this.style.display='none'; Codehighlighter1_62_84_Open_Text.style.display='none'; Codehighlighter1_62_84_Closed_Image.style.display='inline'; Codehighlighter1_62_84_Closed_Text.style.display='inline';" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_62_84_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_62_84_Closed_Text.style.display='none'; Codehighlighter1_62_84_Open_Image.style.display='inline'; Codehighlighter1_62_84_Open_Text.style.display='inline';" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> changeStr(String str) </span><span id="Codehighlighter1_62_84_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span></strong><span id="Codehighlighter1_62_84_Open_Text"><strong><span style="color: #000000">{<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        str </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">"</span><span style="color: #000000">welcome</span><span style="color: #000000">"</span></strong><span style="color: #000000"><strong>;<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />    }</strong></span></span><span style="color: #000000"><br /> <strong><img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /><br /> <img id="Codehighlighter1_127_198_Open_Image" onclick="this.style.display='none'; Codehighlighter1_127_198_Open_Text.style.display='none'; Codehighlighter1_127_198_Closed_Image.style.display='inline'; Codehighlighter1_127_198_Closed_Text.style.display='inline';" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_127_198_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_127_198_Closed_Text.style.display='none'; Codehighlighter1_127_198_Open_Image.style.display='inline'; Codehighlighter1_127_198_Open_Text.style.display='inline';" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />    </strong></span><strong><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> main(String[] args) </span><span id="Codehighlighter1_127_198_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span></strong><span id="Codehighlighter1_127_198_Open_Text"><strong><span style="color: #000000">{<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        String str </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">"</span><span style="color: #000000">1234</span><span style="color: #000000">"</span></strong><span style="color: #000000"><strong>;<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        changeStr(str);<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        System.out.println(str);<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />    }</strong></span></span><span style="color: #000000"><br /> <strong><img src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" alt="" />}</strong></span></span></div> <span style="color: #0000ff; background-color: #ffffff"><strong>杈撳嚭緇撴灉鏄粈涔堬紵wecome?<span style="color: #ff0000">浣犻敊浜嗭紝鏄?1234  涓轟粈涔堝憿錛熷師鍥犲涓嬶細<br /> <br /> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><span style="color: #008000"><!--</span><span style="color: #008000"><br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />    瀵硅薄錛氫竴涓璞″彲浠ヨ寰堝寮曠敤鍏寵仈 <br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />寮曠敤錛氫竴涓紩鐢ㄥ彧鑳藉叧鑱斾竴涓璞?br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />Ojbect xiaoyi1; Ojbect xiaoyi1; Ojbect xiaoyi1; 榪欓噷鍒涘緩浜嗕笁涓紩鐢?nbsp;騫舵病鏈夊垱寤哄璞?br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />xiaoyi xy = new xiaoyi();<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />xy鏄竴涓紩鐢紝 new xiaoyi()榪欎釜鍦ㄥ唴瀛樹腑鍒涘緩浜嗕竴涓璞★紝榪欎釜瀵硅薄琚?nbsp;xy榪欎釜寮曠敤鎵鍏寵仈<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />寮曠敤灝卞ソ姣斾竴涓彞鏌勫璞★紝閫氳繃xy榪欎釜寮曠敤錛堝彞鏌勫璞★級 鍙互鎿嶄綔 new xiaoyi()瀵硅薄<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />寮曠敤涔熸槸涓涓鹼紝鍙笉榪囦粬鐨勫艱褰曚簡鍏跺叧鑱斿璞$殑鍦板潃淇℃伅鑰屽凡銆?br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />public void test(String s1){ <br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />鍙鏄弬鏁板湪鏂規硶鍐呬嬌鐢ㄦ椂錛岄兘浼氫駭鐢熷弬鏁扮殑鍓湰鐨?璁頒綇榪欎竴鐐癸紝鏃犺java錛孋#,C,C++銆?nbsp;<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />1>String temp = s1;<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />榪欓噷s1鍙槸涓涓紩鐢ㄧ殑鍓湰錛屾槸瀹為檯S1寮曠敤鐨勪竴鍓湰錛屽ソ姣斾綘main鏂規硶鍐卻tr瀹為檯寮曠敤鐨勫壇鏈?br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />2>s1="welcome";<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />鍦ㄨ繖閲岃繘琛屼氦鎹㈢殑鏃跺欎綘浜ゆ崲鐨勪粎浠呮槸鍓湰鑰屽凡錛岃櫧鐒禨1鍜宮ain鏂規硶鐨剆tr鎸囧悜鍚屼竴涓璞★紝浣嗘槸浣犱氦鎹㈢殑鏄痬ain鏂規硶str寮曠敤鐨勫壇鏈屽凡<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />鍙﹀錛歋tring str="XIAOYI";<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />str.toLowerCase() ;<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />System.out.println(str);<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />緇撴灉鏄粈涔堬紵xiaoyi? 閭d箞浣犲張閿欎簡銆傘?br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />鍥犱負鍦ㄤ綘璋冪敤toLowerCase(錛夋柟娉曟槸浼氭柊寮杈熷唴瀛樻潵淇濆瓨杞崲瀹屾垚鐨勫璞★紝鑰屼綘騫舵病鏈夋妸鍘熸潵瀵硅薄鐨勫紩鐢ㄩ噸鏂板叧鑱旇杞崲鍚庣殑瀵硅薄錛屾墍浠ヨ緭鍑虹殑浠嶇劧鏄漿鎹㈠墠鐨勫璞?nbsp;XIAOYI,瑕佹兂鏀瑰彉緇撴灉鎬庝箞鍔烇紵<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />閲嶆柊鍏寵仈:str=str.toLowerCase();  榪欐牱灝卞彲浠ヤ簡<br /> <img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #008000">--></span></div> <br /> 鍏充簬  Java瀛楃涓叉睜(String pool)<br /> <p>public   class   Sub{   <br /> String   str=new   String( "good ");   <span style="color: #008080">//涓涓湴鍧鐨勪紶閫?new鍑烘潵鐨勫璞★紝鍦ㄥ唴瀛樹腑宸茬粡寮杈熶簡絀洪棿<br /> </span> <br /> public   static   void   main(String   args[]){   <br /> Sub   ex=new   Sub();   <br /> ex.change(ex.str);   <br /> System.out.println(ex.str);   <br /> }   <br /> public   void   change(String   bb){   <br /> bb= "test   ok " }</p> <p><font color="#ff0000"><span style="color: #008080"><font color="#ff0000">闂錛?/font>String   str=new   String( "good ") 鍜孲tring str="good"鐨勫尯鍒紵</span></font></p> <p><font color="#ff0000">浣撲細1錛?/font><clk><span style="color: #008080">str鏄竴涓猄tring綾誨瀷鐨勫璞″紩鐢紝浠栨槸Sub綾葷殑綾誨彉閲忋傚綋ex瀵硅薄寮曠敤浣跨敤change鏂規硶鏃躲俠b鏄痵tr寮曠敤鐨勬嫹璐濄傚彲浠ラ氳繃bb璁塊棶鍘焥tr鐨勫璞°傝屾柟娉曢噷褰揵b="test ok"鐨勬椂鍊欎粬鎶奲b鎸囧悜浜嗕竴涓柊鐨勫璞′腑銆傝繖鏃跺欐垜浠氨瑕佸紩鍑?nobr oncontextmenu="return false" onmousemove="kwM(0)" id="clickeyekey0" onmouseover="kwE(event,0, this)" style="border-bottom: #6600ff 1px dotted; background-color: transparent; text-decoration: underline" onclick="kwC(event,0)" onmouseout="kwL(event,this)">java</nobr>瀛楃涓茬殑姒傚康浜嗐?/span></clk></p> <p><font color="#ff0000">浣撲細2錛?/font><span style="color: #008080">瀛楃涓叉睜錛堣漿錛?/span><font face="Courier New, Courier, Monospace, Simsun" color="#0000ff">String a = "Hello";<br /> String b = "Hello";<br /> String c = new<strong><font color="#000000"> </font></strong>String("Hello");<br /> String d = new String("Hello");<br /> System.out.println(a == b);<br /> System.out.println(b == c);<br /> System.out.println(c == d);<br /> System.out.println(a.equals(b));<br /> System.out.println(b.equals(c));<br /> System.out.println(c.equals(d));</font></p> <p><span style="color: #008080">緇撴灉鏄痶rue錛宖alse錛宖alse錛宼rue錛宼rue錛宼rue銆傝繖閲屽氨娑夊強鍒板瓧絎︿覆姹犮?#8220;瀛楃涓叉睜”錛屾槸Java涓轟簡鎻愰珮鍐呭瓨鍒╃敤鐜囪岄噰鐢ㄧ殑鎺柦錛?/span></p> <p><span style="color: #008080">褰撻亣鍒癝tring a = "Hello"; 榪欐牱鐨勮鍙ユ椂錛孞ava浼氬厛鍦ㄥ瓧絎︿覆姹犱腑瀵繪壘鏄惁宸茬粡瀛樺湪"Hello"榪欎釜瀛楃涓?濡傛灉娌℃湁錛屽垯寤虹珛瀛楃涓?Hello"瀵硅薄錛岀劧鍚庡彉閲?a 鎸囧悜榪欎釜鍦板潃錛涚劧鍚庨亣鍒拌鍙tring b = "Hello"錛岃繖鏃跺瓧絎︿覆姹犱腑宸茬粡鏈?"Hello"浜嗭紝鎵浠ョ洿鎺ヨ鍙橀噺b涔熸寚鍚戣繖涓湴鍧錛岀渷鍘諱簡閲嶆柊鍒嗛厤鐨勯夯鐑︺傝屽湪Java涓紝鎿嶄綔絎?#8220;==”瀵逛簬涓や釜鍩烘湰鍨嬫潵璇達紝鏄垽鏂叾鍐呭鏄惁鐩稿悓錛屽浜庝袱涓璞℃潵璇達紝鍒欐槸鍒ゆ柇鍏跺湴鍧鏄惁鐩稿悓錛屾墍浠 == b榪斿洖 true銆?/span></p> <p><span style="color: #008080">閭d箞String c = new String("Hello")鍙堝浣曞鐞嗗憿錛熷鏋滄槸榪欑鍐欐硶錛屽垯涓嶄細鍘昏闂瓧絎︿覆姹狅紝鑰屾槸鍏堜負鍙橀噺 c 寮杈熺┖闂達紝鐒跺悗灝嗗煎啓鍏ョ┖闂淬傛墍浠 == c榪斿洖false錛宑 == d鍚屾牱榪斿洖false銆?/span></p> <p><span style="color: #008080">鑷充簬String鐨別quals鏂規硶錛屽洜涓哄畠姣旇緝鐨勪笉鏄璞$殑鍦板潃錛岃屾槸瀵硅薄鐨勫鹼紝鎵浠ラ兘榪斿洖true灝變笉濂囨簡銆?/span></p> <p><span style="color: #008080">Java铏氭嫙鏈烘湁涓涓瓧絎︿覆姹狅紝淇濆瓨鐫鍑犱箮鎵鏈夌殑瀛楃涓插璞°傚瓧絎︿覆琛ㄨ揪寮忔繪槸鎸囧悜瀛楃涓叉睜涓殑涓涓璞°備嬌鐢╪ew鎿嶄綔鍒涘緩鐨勫瓧絎︿覆瀵硅薄涓嶆寚鍚戝瓧絎︿覆姹犱腑鐨勫璞′絾鏄彲浠ヤ嬌鐢╥ntern鏂規硶浣垮叾鎸囧悜瀛楃涓叉睜涓殑瀵硅薄.錛堟敞錛氬鏋滄睜涓凡緇忔湁鐩稿悓鐨勫瓧絎︿覆--浣跨敤equals鏂規硶紜畾錛屽垯鐩存帴榪斿洖姹犱腑鐨勫瓧絎︿覆錛屽惁鍒欏厛灝嗗瓧絎︿覆娣誨姞鍒版睜涓紝鍐嶈繑鍥烇級銆傛睜涓袱涓浉絳夌殑瀛楃涓插鏋滀嬌鐢?#8220;==”鏉ユ瘮杈冨皢榪斿洖鐪熴?/span></p> <p><span style="color: #008080"><font color="#ff0000">鎬葷粨錛?/font>涔熷氨鏄湪change榪欎釜鏂規硶涓紝bb宸茬粡鍐欏叆str絀洪棿銆傝宐b鍦ㄧ瓑浜?#8220;test ok”鐨勬椂鍊欐槸榪愮敤瀛楃涓叉睜鍒涘緩浜嗗璞′腑浜嗐傛墍浠ヤ笉鑳借祴鍊箋傚彲浠ヨ繖鏍?bb="test ok"; this.str=bb;</span></p> <p><span style="color: #008080">鐞嗚В鏈夐敊璇紝甯屾湜鐪嬪埌鐨勯珮鎵嬪彲浠ュ憡璇夋垜錛屼互渚挎垜鍙互鏇村ソ鐨勪慨鏀癸紝璋㈣阿浜嗐?/span></p> <br /> </span></strong></span> <img src ="http://m.tkk7.com/xiaoyi/aggbug/224118.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/xiaoyi/" target="_blank">鍙埍鐨勫皬姣?/a> 2008-08-25 12:22 <a href="http://m.tkk7.com/xiaoyi/articles/224118.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://m.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://xx2015.com" target="_blank">亚洲高清国产拍精品熟女</a>| <a href="http://ninggelang.com" target="_blank">亚洲成a人片在线观看中文app</a>| <a href="http://wwwabxx.com" target="_blank">亚洲中文字幕成人在线</a>| <a href="http://www988555.com" target="_blank">亚洲色婷婷综合久久</a>| <a href="http://minliusoft.com" target="_blank">亚洲人精品午夜射精日韩</a>| <a href="http://sdtuoliuta.com" target="_blank">亚洲人成网址在线观看</a>| <a href="http://yese889.com" target="_blank">亚洲国产福利精品一区二区</a>| <a href="http://mqiuxia66.com" target="_blank">久久精品熟女亚洲av麻豆</a>| <a href="http://ksdhao.com" target="_blank">eeuss影院www天堂免费</a>| <a href="http://lzlcp.com" target="_blank">美丽姑娘免费观看在线观看中文版 </a>| <a href="http://szgyk.com" target="_blank">色妞WWW精品免费视频</a>| <a href="http://hairdehf.com" target="_blank">免费观看国产小粉嫩喷水</a>| <a href="http://dunyny.com" target="_blank">亚洲熟女少妇一区二区</a>| <a href="http://kimnote.com" target="_blank">亚洲理论片在线中文字幕</a>| <a href="http://hmjx-tape.com" target="_blank">亚洲av中文无码字幕色不卡</a>| <a href="http://9527paotui.com" target="_blank">国产99精品一区二区三区免费</a>| <a href="http://xfmkt.com" target="_blank">久久永久免费人妻精品下载 </a>| <a href="http://234an.com" target="_blank">久久免费动漫品精老司机</a>| <a href="http://djllgs.com" target="_blank">国产99视频精品免费观看7</a>| <a href="http://zgxxx.com" target="_blank">四虎国产精品免费视</a>| <a href="http://83k5.com" target="_blank">亚洲AV无码不卡无码</a>| <a href="http://kingleadsw.com" target="_blank">在线观看日本亚洲一区</a>| <a href="http://yuntuzy.com" target="_blank">手机永久免费的AV在线电影网</a>| <a href="http://1408600.com" target="_blank">无码一区二区三区免费</a>| <a href="http://anhuish.com" target="_blank">免费激情视频网站</a>| <a href="http://www2019rz.com" target="_blank">亚洲精品无码成人片久久</a>| <a href="http://www759696b.com" target="_blank">亚洲妇女水蜜桃av网网站</a>| <a href="http://fsweicheng.com" target="_blank">深夜特黄a级毛片免费播放</a>| <a href="http://njyadi.com" target="_blank">无码日韩精品一区二区免费暖暖</a>| <a href="http://0730jxpm.com" target="_blank">性色av免费观看</a>| <a href="http://wwwdf221.com" target="_blank">亚洲精品无码MV在线观看</a>| <a href="http://hn283.com" target="_blank">亚洲乱码在线卡一卡二卡新区</a>| <a href="http://mangaou.com" target="_blank">国产成人精品免费大全</a>| <a href="http://732r.com" target="_blank">永久免费毛片在线播放</a>| <a href="http://guhey.com" target="_blank">亚洲乱亚洲乱妇无码麻豆</a>| <a href="http://c2277.com" target="_blank">亚洲中文字幕久久精品无码A</a>| <a href="http://cuuka.com" target="_blank">a级毛片无码免费真人久久</a>| <a href="http://chinashineway.com" target="_blank">女人18毛片水真多免费播放</a>| <a href="http://caocl1024liu.com" target="_blank">国产成人亚洲精品青草天美</a>| <a href="http://tskes.com" target="_blank">亚洲欧洲精品成人久久曰</a>| <a href="http://htsp777.com" target="_blank">日本在线免费观看</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>