JAVA反射的问题,判断以下6个Class是type of a reference variable 还是 type of an objectClass c1 = x.getClass();Class c2 = x.getClass().getDeclaredFields()[0];\x05\x05Class c3 = x.getClass().getDeclaredFields()[0].get(x).getClass();\x05\x05C

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/08 10:04:48
JAVA反射的问题,判断以下6个Class是type of a reference variable 还是 type of an objectClass c1 = x.getClass();Class c2 = x.getClass().getDeclaredFields()[0];\x05\x05Class c3 = x.getClass().getDeclaredFields()[0].get(x).getClass();\x05\x05C

JAVA反射的问题,判断以下6个Class是type of a reference variable 还是 type of an objectClass c1 = x.getClass();Class c2 = x.getClass().getDeclaredFields()[0];\x05\x05Class c3 = x.getClass().getDeclaredFields()[0].get(x).getClass();\x05\x05C
JAVA反射的问题,判断以下6个Class是type of a reference variable 还是 type of an object
Class c1 = x.getClass();
Class c2 = x.getClass().getDeclaredFields()[0];
\x05\x05Class c3 = x.getClass().getDeclaredFields()[0].get(x).getClass();
\x05\x05Class c4 = x.getClass().getMethods()[0].getDeclaringClass();
\x05\x05Class c5 = x.getClass().getMethods()[0].getParameterTypes()[0];
\x05\x05Class c6 = x.getClass().getInterfaces()[0];

JAVA反射的问题,判断以下6个Class是type of a reference variable 还是 type of an objectClass c1 = x.getClass();Class c2 = x.getClass().getDeclaredFields()[0];\x05\x05Class c3 = x.getClass().getDeclaredFields()[0].get(x).getClass();\x05\x05C
Class
getDeclaringClass()
Returns the Class object representing the class or
interface that declares the method represented by this Method
object
Class
getReturnType()
Returns a Class object that represents the formal
return type of the method represented by this Method object.
Class[]
getInterfaces()
Determines the interfaces implemented by the class or interface
represented by this object.
Field[]
getDeclaredFields()
Returns an array of Field objects reflecting all the
fields declared by the class or interface represented by this Class
object.
java文档里写的很清楚 你看看上三个函数是你用到 它们的返回值都是Class 最后一个返回Field[] 对照你写的看看 除了c2是个变量外 其他的都是类对象