java Ëæ»ú²úÉú×Ö·û´®
ת×Ô £º http://hi.baidu.com/samuel_vong/blog/item/95471f7e2cdab33d0cd7dad1.html
/**
* ²úÉúËæ»ú×Ö·û´®
* */
private static Random randGen = null;
private static char[] numbersAndLetters = null;
private static Object initLock = new Object();
public static final String randomString(int length) {
if (length < 1) {
return null;
}
if (randGen == null) {
synchronized (initLock) {
if (randGen == null) {
randGen = new Random();
numbersAndLetters = ("0123456789abcdefghijklmnopqrstuvwxyz" +
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ").toCharArray();
//numbersAndLetters = ("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ").toCharArray();
}
}
}
char [] randBuffer = new char[length];
for (int i=0; i<randBuffer.length; i++) {
&n
Ïà¹ØÎĵµ£º
·â×°ÀàÒ²½Ð°ü×°À࣬ÊÇÕë¶Ô°ËÖÖ»ù±¾¶¨ÒåÏàÓ¦µÄÒýÓÃÀàÐÍ¡£
»ù±¾Êý¾ÝÀàÐÍ ·â×°Àà
boolean &nbs ......
Java Singleton
ģʽ(µ¥Éíģʽ,µ¥Ì¬Ä£Ê½)ÊÇÒ»ÖÖ´´½¨ÐÍÉè¼Æģʽ¡£ÓÃÀ´±£Ö¤ÔÚÔËÐеÄÓ¦ÓóÌÐòÖУ¬Ò»¸öClassÖ»ÊÇʵÀý»¯Ò»´Î£¬Ò²¾ÍÊÇÖ»ÓÐÒ»¸öÏàÓ¦µÄ¶ÔÏó´æÔÚ¡£ÔÚ
web ³ÌÐòÖÐÎÒÃÇ»áÓÃÒ»¸öºËÐĵķÖÅ书ÄܵÄServlet³ÌÐò£¬ÔÚÕâÀïÎÒÃǾͿÉÒÔÔËÓÃÕâÖÖÉè¼ÆģʽÁË¡£ ......
JavaÈÕ»ýÔÂÀÛ-1£ºJavaÖÐbooleanÀàÐ͵ÄλÔËËã
1. Ê×ÏȻعËÒ»ÏÂjavaÖеÄ8Öлù±¾ÀàÐͼ°Æä´æ´¢ËùÕ¼ÓõÄbitÊý¡£
ÀàÐÍ
bitÊý
byte
8
short
16
int
32
float
32
long
64
double
64
char
16
boolean
1
2. ÔٻعËÒ»ÏÂjavaµÄÔËËã·ûºÍÓÅÏȼ ......
ÄÇÌìÕý͵×ŲËͻȻ¾ÍÏëµ½ÁËΪºÎ²»×öÒ»¸öÅ©³¡ÄØ£¿
ÕýºÃ¸ÒÉϽá¿ÎÏîÄ¿¾ÍÒª¿ªÊ¼ÁË,ÀÏʦÓÖ´ß×ÅÕÒÏîÄ¿ÁË¡£
˵×ö¾Í×öÁË£¬
µ«´ÓÀ´Ã»ÓÐÉæ¼°¹ýÍøÒ³ÓÎÏ··½Ã棬Ȼºó·è¿ñ²é×ÊÁÏ£¬£¬ÊÕ»ñÈ´²»¶à£¬·¢ÏÖ×Ô¼ºÖªµÀ µÄÌ«ÉÙÁ˲»¾«flash£¬flexÒ²²»»á£¬¹â½çÃæ¾Í²»ºÃ°ì£¬
µ«ÊǼÈÈ»Ïëµ½ÕâÁË£¬²»»áÒ²ÒªÉÏÁË£¬£¬¹þ¡£
²»»áflashÁËÎÒ¾ÍÓÃcss+javascri ......
Java¶¯Ì¬´úÀíÀàλÓÚJava.lang.reflect°üÏ£¬Ò»°ãÖ÷ÒªÉæ¼°µ½ÒÔÏÂÁ½¸öÀࣺ
(1). Interface InvocationHandler£º¸Ã½Ó¿ÚÖнö¶¨ÒåÁËÒ»¸ö·½·¨Object£ºinvoke(Object obj,Method method, Object[] args)¡£ÔÚʵ¼ÊʹÓÃʱ£¬µÚÒ»¸ö²ÎÊýobjÒ»°ãÊÇÖ¸´úÀíÀ࣬methodÊDZ»´úÀíµÄ·½·¨£¬ÈçÉÏÀýÖеÄdothing()£¬argsΪ¸Ã·½·¨µÄ²ÎÊýÊý×é¡£ ......