javaÖеĶ¯Ì¬´úÀí
JavaÔÚJDK1.3Ö®ºó¼ÓÈëÁË¿ÉÐÖú¿ª·¢¶¯Ì¬´úÀí¹¦ÄܵÄAPI.ʹÓö¯Ì¬´úÀí£¬¿ÉÒÔʹһ¸ö´¦ÀíÕߣ¨´úÀí£©·þÎñÓÚ¸÷¸ö¶ÔÏó¡£´´½¨Ò»¸ö¶¯Ì¬´úÀíÀàÖ»ÐèʵÏÖjava.lang.reflect.InvocationHandler½Ó¿Ú¡£
ÏÂÃæ´´½¨Ò»¸ö´¦ÀíÈÕÖ¾µÄ¶¯Ì¬´úÀíÀàLogHandlerÈ¥´úÀíHelloSpeakerÀà
Ê×ÏÈ´´½¨HelloSpeakerµÄ½Ó¿Ú
package com.test;
public interface IHello {
public void sayHello(String name);
}
È»ºó´´½¨HelloSeaker
package com.test;
public class HelloSpeaker implements IHello {
public void sayHello(String name) {
System.out.println("hello:"+name);
}
}
×îºó´´½¨LogHandlerÀà
package com.test;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.logging.Logger;
public class LogHandler implements InvocationHandler {
private Logger logger = Logger.getLogger(this.getClass().getName());
private Object delegate;
public Object bind(Object delegate) {
this.delegate = delegate;
return Proxy.newProxyInstance(delegate.getClass().getClassLoader(),
delegate.getClass().getInterfaces(), this);
}
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
Object result = null;
try {
logger.info("method start..." + method);
result = method.invoke(delegate, args);
logger.info("method end..." + method);
} catch (Exception e) {
logger.info(e.getMessage());
}
return result;
}
}
ºÃÁË£¬ÏÖÔÚÎÒÃDZàдһ¸ö²âÊÔÀàDemo
package com.test;
public class Demo {
public Demo() {
// TODO Auto-generated constructor stub
}
/**
* @param args
*/
public static void main(String[] args) {
LogHandler logHandler = new LogHandler();
&
Ïà¹ØÎĵµ£º
ÀàÃû£º
java.util.Date
¹¹Ôì·½·¨£º
¹¹Ôì·½·¨ ½â˵
Date()
ÎÞ²ÎÊýµÄ¹¹Ôì·½·¨£¬½«¹¹½¨Ò»¸ö±£³Öµ±Ç°ÈÕÆÚ.ʱ¼äµÄDate¶ÔÏó¡£
Date(long time)
²ÎÊýΪ1970Äê1ÔÂ1ÈÕ00ʱ00·Ö00ÃëÆðËù¾¹ýµÄºÁÃëÊý£¬½«¹¹½¨Ò»¸ö±£³Ö¸ÃÈÕÆÚ.ʱ¼äµÄ¾«È·µ½ºÁÃëµÄDate¶ÔÏó¡£
ÆäËûÓÐЩ¹¹Ôì·½·¨ÒѾ²»ÍƼöʹÓã¬ÕâÀï² ......
win7ϵͳÏÂJava»·¾³±äÁ¿µÄÅäÖà Jdk°æ±¾Îª1.6
´ò¿ª¿ØÖÆÃæ°å->Óû§ÕÊ»§->¸ü¸ÄÎҵĻ·¾³±äÁ¿
±äÁ¿Ãû£ºJAVA_HOME
±äÁ¿Öµ£ºD:\Program Files\Java\jdk1.6.0_12(ÕâÖ»ÊÇÎÒµÄJDK°²×°Â·¾¶)
±äÁ¿Ãû£ºPath
ÔÚ±äÁ¿ÖµµÄ×îÇ°Ãæ¼ÓÉÏ£º%JAVA_HOME%\bin;£¨ÈôÒѾÓÐPathÏÎÞÐëÁíÍâР......
ÖØдµÄÖ÷ÒªÓŵãÊÇÄܹ»¶¨Òåij¸ö×ÓÀàÌØÓеÄÌØÕ÷:
Èç:
public class Father
{
public void speak()
&nb ......
×î½üÒòΪÏîÄ¿ÐèÒª£¬Ñо¿ÁËjava html parserÀà¿âµÄÓ¦Ó᣼ǼÏÂʹÓÃÒªµã£º
Ö÷ÒªµÄÀà˵Ã÷£º
1¡¢ParserÀà
½âÎöÆ÷Ö÷À࣬¸ºÔðÔØÈëHTML´úÂë²¢½âÎö¡£
2¡¢Node½Ó¿Ú
ÓÃÀ´±íÕ÷ÔÚ½âÎö¹ý³ÌÖÐʹÓõÄÓï·¨µ¥Ôª¡£Ê¾ÀýÈç϶Îhtml´úÂ룺
<span> ----Tag node
text ----Text Node
</span>
Îı¾ºÍ±êÇ©¶¼ÊǶÀÁ¢µÄnodeÔªËØ¡ ......
(ת£ºhttp://blog.csdn.net/alex197963/archive/2008/03/26/2219994.aspx)
1.»ù±¾¸ÅÄîµÄÀí½â
¡¡¡¡¾ø¶Ô·¾¶:¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶,(URLºÍÎïÀí·¾¶)ÀýÈç:
C:xyz est.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶.http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸ö
URL¾ø¶Ô·¾¶.
¡¡¡¡Ïà¶Ô·¾¶:Ïà¶ÔÓëij¸ö» ......