javaÖеķ´Éä»úÖÆÖÐinvokeµäÐÍÓ÷¨
javaÖеķ´Éä»úÖÆͨ¹ýinvoke·½·¨À´ÊµÏÖ£¬ÕâÖмäÖ÷ÒªÊÇÊÇͨ¹ýһϼ¸¸öº¯ÊýʵÏÖµÄ
Class.forName ("ˈ̞")
Class.forName ("ˈ̞").newInstance
Class.getMethod ("µ÷Óõķ½·¨Ãû",class[]{²ÎÊýÀàÁбí})
instance.getClass
Method.invoke ("¶ÔÏóÃû","²ÎÊý·â×°³ÉµÄ¶ÔÏó")
¾ßÌåÔõôʵÏÖ£¬ÈÃÎÒÃÇÀ´¿´Ò»¸ö¼òµ¥µÄÀý×Ó£º
Class InvokeTest{
private static String algorithm = "Algorithm";
Object invokeMethod(object instance,String fun, Class[] paras, Object[] paraValue){
Object result = null;
Method method;
try{
method = instance.getClass.getMethod(fun, paras);
result = method.invoke(instance, paraValue);
}catch(Exception e) {
e.printStackTrace();
result = null;
}
}
public static void main(){
int x= 10,y=20;
invokeMethod(Class.forName(algorithm),newInstance,"add", Class[] {Class.int,Class.int},
Object[] { new Integer(x), new Integer(y)})
}
}
Class Algorithm{
public int add(int a,int b){
return a+b;
}
}
ÉÏÃæ´úÂë¼ò½àµØ˵Ã÷ÁËinvokeµÄʹÓã¬ÖÁÓÚÔÀí£¬Õⲿ·Ö²¢²»ÀÛÊö¡£
Ïà¹ØÎĵµ£º
1ÈçºÎ½«×Ö´® String ת»»³ÉÕûÊý int?
A. ÓÐÁ½¸ö·½·¨:
1). int i = Integer.parseInt([String]); »ò
i = Integer.parseInt([String],[int radix]);
2). int i = Integer.valueOf(my_str).intValue();
×¢: ×Ö´®×ª³É Double, Float, Long µÄ·½·¨´óͬСÒì.
2 ÈçºÎ½«ÕûÊý int ת»»³É×Ö´® String ?
A. ÓÐÈþÖÖ·½·¨:
1.) ......
package io;
import java.io.*;
/**
* @author ¸ßÕíÎâÓÇ
* ÀûÓûº³åÇøÔÀí,BufferedInputStream,
* ʵÏÖµÄÎļþ×Ö½ÚÁ÷¶ÁÈ¡¹¦ÄÜʾ·¶
*
*/
public class BufferedInOutputStream {
public BufferedInOutputStream() {
ioTest2();
}
public void ioTest2() {
FileInputStream in = null ;
Buffered ......
LuceneÊÇÒ»¸ö»ùÓÚJavaµÄÈ«ÎÄË÷Òý¹¤¾ß°ü¡£
»ùÓÚJavaµÄÈ«ÎÄË÷ÒýÒýÇæLucene¼ò½é£º¹ØÓÚ×÷ÕߺÍLuceneµÄÀúÊ·
È«ÎļìË÷µÄʵÏÖ£ºLueneÈ«ÎÄË÷ÒýºÍÊý¾Ý¿âË÷ÒýµÄ±È½Ï
ÖÐÎÄÇзִʻúÖƼò½é£º»ùÓÚ´Ê¿âºÍ×Ô¶¯ÇзִÊËã·¨µÄ±È½Ï
¾ßÌåµÄ°²×°ºÍʹÓüò½é£ºÏµÍ³½á¹¹½éÉܺÍÑÝʾ
Hacking Lucene£º¼ò»¯µÄ²éѯ·ÖÎöÆ÷£¬É¾³ýµÄʵÏÖ£¬¶¨ÖƵÄÅÅÐò£¬Ó ......
Ç°Ò»¶Î×ö¸ö³ÌÐò£¬Óöµ½ÁËÕâÑùÒ»¸öÎÊÌ⣬ÏëÀûÓÃÏà¶Ô·¾¶É¾µôÒ»¸öÎļþ(ʵ¼Ê´æÔÚµÄ),ÀÏÊÇɾ²»µô. ÕæÊǼ±ÈËѽ£¬×îºóÈÃÎÒ·ÑÁ˺ôóÁ¦Æø²ÅËã°ÑËü½â¾öµô£¬ÎÊÌâ²»·À¸ú´ó¼Ò˵˵£¬ÍòÒ»Óöµ½ÕâÑùµÄÎÊÌ⣬¾Í²»ÓÃÔٷѾ¢ÁË£¡
Çé¿öÊÇÕâÑùµÄ£ºÎÒµÄTomcat×°ÔÚÁËcÅÌ£¬¶øÎÒµÄÐéÄâĿ¼ÉèÔÚÁËE ......
http://renyanwei.javaeye.com/blog/258304
ÎÒÃÇÖªµÀ£¬ÔÚJAVAÖУ¬×ÓÀà¿ÉÒԼ̳и¸À࣬Èç¹û×ÓÀàÉùÃ÷µÄ·½·¨Ó븸ÀàÓÐÖØÃûµÄÇé¿öÔõô°ì£¬´ó»ï¶ù¶¼ÖªµÀÒªÊÇÖØд£¬µ«ÊÇʵ¼ÊÉÏÕâÓÖ·ÖΪÁ½ÖÖÇé¿ö£¬¾ÍÊÇ·½·¨ºÍ±äÁ¿Ôڼ̳ÐʱµÄ¸²¸ÇºÍÒþ²ØÎÊÌ⣬ÕâЩ¸ÅÄîÐԵĶ«Î÷¿´ËÆÎÞÁÄ£¬µ«ÊÇÔÚÃæÊÔ»òÕßÊÇSCJPÈÏÖ¤ÌâÖÐΧÈÆÕâЩÊǻᾳ£Åöµ½µÄ£¬ËùÒÔÕâÀï ......