Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void printFieldNames()
- {
- Field[] fields = ClassName.class.getDeclaredFields();
- //gives no of fields
- System.out.println(fields.length);
- for (Field field : fields)
- {
- //gives the names of the fields
- System.out.println(field.getName());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement