how to print the class java code example
Example 1: Java print class type
System.out.println(foo.getClass().getName());
Example 2: print object java
System.out.println(myObject); // invokes myObject.toString()
System.out.println(foo.getClass().getName());
System.out.println(myObject); // invokes myObject.toString()