how to print any class value in java code example Example: Java print class type System.out.println(foo.getClass().getName());