package com.heima;
public class Field {
public static void main(String [] args)
{
person p=new person(3,4)
Field fx=p.getClass().getField("x");
//System.out.println(fx.get(p));
}
}
Field fx=p.getClass().getField("x");
这句话编译不通过,报错:Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from java.lang.reflect.Field to com.heima.Field
谁能解答一下 |
|