?? getproperty.java~1~
字號:
package hellojxta;
import java.lang.reflect.*;
public class getproperty {
//static String string=null;
static String s=null;
static int i;
static Object object=null;
public static String getconfig(String className,String string){
System.out.println("ok");
/* if((i=className.lastIndexOf("."))!=-1){
object=(Object)className.substring(i+1);
System.out.println(object);
}
else{
object=(Object)className;
}*/
try{
System.out.println(className);
//string=string;
// Class propertyclass = Class.forName("hellojxta.property");
Class propertyclass = Class.forName(className);
System.out.println(className);
Field field=propertyclass.getField(string);
//System.out.println(string);
object=propertyclass.newInstance();
// hellojxta.property property=new hellojxta.property();
// object property=new object();
//(Object)className property=new (Object)className();
//getproperty getproperty=new getproperty();
//s=(String)field.get(property);
s=(String)field.get(object);
return s;
}catch(Exception e){
e.printStackTrace();
}
return s;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -