Java Field.toGenericString()
Syntax
Field.toGenericString() has the following syntax.
public String toGenericString()
Example
In the following code shows how to use Field.toGenericString() method.
import java.lang.reflect.Field;
/*w w w. ja v a2 s . c om*/
public class Main {
public static void main(String args[]) throws Exception{
Class c = Class.forName("java.awt.Dimension");
Field fields[] = c.getFields();
for (int i = 0; i < fields.length; i++) {
System.out.println(fields[i].toGenericString());
}
}
}
The code above generates the following result.