📄 getproperty.java~1~
字号:
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 + -