Java tutorial
//package com.java2s; import java.lang.ref.Reference; import java.util.Arrays; public class Main { static void printObject(Object obj) { System.out.println("find threadlocal var:" + obj); if (obj instanceof Object[]) { System.out.println("array:" + Arrays.deepToString((Object[]) obj)); } else if (obj instanceof Reference) { Reference ref = (Reference) obj; System.out.println("ref: " + ref.getClass().getName() + ",ref to " + ref.get()); } else { System.out.println("others: " + obj); } } }