Retrieve Fields Information of class using java Reflection APIs

Using Java Reflecion APIs you can get fields information of class easily. just create object of class and get fields using getFields();

Java Program to retrieve fields information using java Reflection Apis :
Field[] fields = originalClassObj.getFields();
System.out.println("Fields used - ");
for (int i = 0; i < fields.length; i++) {
    System.out.println(fields[i].getName());
}


No comments:

Post a Comment