Java tutorial
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Field; public class Main { public static void printObject(Object object) { Class<?> class1 = object.getClass(); Field[] fields = class1.getDeclaredFields(); for (Field field : fields) { try { field.setAccessible(true); } catch (IllegalArgumentException e) { e.printStackTrace(); } } } }