Java how to print an instance of the class 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()