Java???????
???????????? ???????[ 2014/5/23 10:15:32 ] ????????Java??????? ???????
public static void main(String[] args)throws Exception{
String str1="abc";
Class cls1=str1.getClass();
Class cls2=String.class;
Class cls3=null;
try {
cls3 = Class.forName("java.lang.String");//????????????
} catch (ClassNotFoundException e) {
System.out.println(e.toString());
}
System.out.println(cls1 == cls2);//????????????????
System.out.println(cls1 == cls3);
//????????????г????????????и????Class?????????:int[]??void...
System.out.println(cls1.isPrimitive());//isPrimitive?÷?????String?????????????ж?String???????????????????????????flase
System.out.println(int.class.isPrimitive());//int ??????????????
System.out.println(int.class == Integer.class);//Integer ????????????????????????
System.out.println(int.class == Integer.TYPE);//Integer?????????????????TYPE??
System.out.println(int[].class.isPrimitive());//?????????????
System.out.println(int[].class.isArray());//?ж????Class?????????
/*
* ???з???
* ???????Java???е????????????????java??
* ???磺
* ???Java???????Class???????????????????е??????????????????????????????????????????????java?????????
*/
//??????????????
Student st=new Student("a"??5);
Field fd1=st.getClass().getField("age");
System.out.println(fd1.get(st));
//???????????????setAccessible ???????÷?????????е???
Field fd2=st.getClass().getDeclaredField("name");
fd2.setAccessible(true);//????????
System.out.println(fd2.get(st));
//???????
Method metchar=Student.class.getMethod("show"??int.class??int.class);
System.out.println(metchar.invoke(st??1??2));//invoke???????????????????????????????
changeStringvalue(st);
System.out.print(st);
//?????? ???????е?????б?
Class classType1=Student.class;//?????????????class???????
//Class classType=Class.forName("FanSheDemo.Student");//?????????????
Method[] met=classType1.getDeclaredMethods();
for(Method m:met){
System.out.println(m);
}
}
//????????????
private static void changeStringvalue(Object o){
Field[] fd=o.getClass().getFields();
for(Field f:fd){
if(f.getType()==String.class){
try {
String aldValue=(String)f.get(o);
String newValue=aldValue.replace('a'?? '1');
f.set(o??newValue);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
}
}
|
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????