<!-- 子元素过滤选择器 -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta http-equiv"Content-Type" content"text/html; charsetUTF-8&qu…
<!-- 表单过滤选择器 -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta http-equiv"Content-Type" content"text/html; charsetUTF-8"…
1.代码举例
/*** author wkq* date 2020/3/5 - 13:36* Person类*/
public class Person {public String name;private int age;public Person(String name, int age) {this.name name;this.age age;}public Person() {System.out.println("Person()");}private Pe…
我们可以通过反射,获取对应的运行时类中所有的属性、方法、构造器、父类、接口、父类的泛型、包、注解、异常等。。。。 典型代码:
package java1;/*** author wkq* date 2020/3/9 - 22:07*/
MyAnnotation(value "hi")
public class Person …
//调用指定的属性:
Test
public void testField1() throws Exception {Class clazz Person.class;//创建运行时类的对象Person p (Person) clazz.newInstance();//1. getDeclaredField(String fieldName):获取运行时类中指定变量名的属性Field name clazz.getDec…