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

Java»ñµÃÖ¸¶¨ClassLoaderËù¼ÓÔØµÄÀàÁбí

     Ò»Ö±ÏëʵÏÖÏñDriverManagerÄÇÑùµÄgetConnection·½·¨£¬Í¨¹ý´Ë·½·¨¾Í¿ÉÒÔ»ñµÃÁ¬½Ó£¬¶øÇÒ»¹²»ÓÃÖ¸¶¨Driver£¬µ«Ç°ÌáÊÇDriverÒѾ­Í¨¹ýClass.forName()»ònew Driver()½øÐÐÁ˼ÓÔØ¡£½ñÌìÖÕÓÚµÃÒÔʵÏÖ¡£
      package quiz;
import java.lang.reflect.Field;
public class ClassLoaderDriver {
/**
* @param args
* @throws NoSuchFieldException
* @throws SecurityException
* @throws IllegalAccessException
* @throws IllegalArgumentException
* @throws ClassNotFoundException
*/
public static void main(String[] args) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ClassNotFoundException {
Class.forName("com.mysql.jdbc.Driver");
Field field = ClassLoader.class.getDeclaredField("classes");
field.setAccessible(true);//ÉèÖøóÉÔ±±äÁ¿Îª¿É·ÃÎÊ
System.out.println(field.get(ClassLoader.getSystemClassLoader()));
}
}

ÕâÑùÒ»À´£¬ÎÒÃǾͿÉÒÔʵÏÖºÍDriverManagerÀàËÆµÄ¹¦ÄÜÁË¡£


Ïà¹ØÎĵµ£º

JavaÉèÖÃclasspth,path,java_home»·¾³±äÁ¿µÄÄ¿µÄ(ת)

Ê×ÏȽéÉÜһϻ·¾³±äÁ¿µÄÉèÖ÷½·¨£º
£¨ÕâÀïÒÔjdk1.6À´°²×°£¬ÆäËû°æ±¾Ò»Ñù£©
ÔÚ°Ñjdk°²×°µ½¼ÆËã»úÖÐÖ®ºó£¬ÎÒÃÇÀ´½øÐÐÉèÖÃʹjava»·¾³Äܹ»Ê¹Óá£
        
Ê×ÏÈÓÒ¼üµãÎҵĵçÄÔ¡£´ò¿ªÊôÐÔ¡£È»ºóÑ¡Ôñ“¸ß¼¶”ÀïÃæµÄ“»·¾³±äÁ¿”£¬ÔÚеĴò¿ª½çÃæÖеÄϵͳ±äÁ¿Ðè ......

Java»ñÈ¡¸÷ÖÖ³£ÓÃʱ¼ä·½·¨

package com.test;


import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class TimeTest {
//ÓÃÀ´ ......

javaÃæÊÔ³£¼ûÎÊÌâ


1 ¡¢ÃæÏò¶ÔÏóµÄÌØÕ÷ÓÐÄÄЩ·½Ãæ
1.³éÏó£º
³éÏó¾ÍÊǺöÂÔÒ»¸öÖ÷ÌâÖÐÓ뵱ǰĿ±êÎ޹صÄÄÇЩ·½Ã棬ÒÔ±ã¸ü³ä·ÖµØ×¢ÒâÓ뵱ǰĿ±êÓйصķ½Ãæ¡£³éÏó²¢²»´òËãÁ˽âÈ«²¿ÎÊÌ⣬¶øÖ»ÊÇÑ¡ÔñÆäÖеÄÒ»²¿·Ö£¬ÔÝʱ²»Óò¿·Öϸ½Ú¡£³éÏó°üÀ¨Á½¸ö·½Ã棬һÊǹý³Ì³éÏ󣬶þÊÇÊý¾Ý³éÏó¡£
2.¼Ì³Ð£º
¼Ì³ÐÊÇÒ»ÖÖÁª½áÀàµÄ²ã´ÎÄ£ÐÍ£¬²¢ÇÒÔÊÐíºÍ¹ÄÀøÀൠ......

ÔÚJavaÖÐÁ½ÖÖ²»Í¬µÄ¶Ô±äÁ¿¸³Öµ·½Ê½

ÔÚJavaÖÐÓÐÁ½ÖÖ²»Í¬µÄ¶Ô±äÁ¿¸³Öµ·½Ê½£¬Ò»ÖÖÊÇÖ±½Ó½«Ò»¸öÖµ¸³¸ø±äÁ¿¡£ÀýÈ磺
int a = 1;
String s = "abc";
Integer in = 125;
ÁíÍâÒ»ÖÖÊÇ´´½¨Ò»¸ö¶ÔÏ󣬲¢½«Æä¸³¸øÒ»¸ö±äÁ¿¡£ÀýÈ磺
String s = new String("abc")
Integer in = new Integer(125);
Á½ÖÖ·½Ê½µÄ²»Í¬Ö®´¦ÔÚÓÚ£º
µÚÒ»ÖÖ·½Ê½±äÁ¿µÄÖµ´æ´¢ÔÚ¶ÑÕ»ÖУ¬µ±ÏÂÒ» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ