title: Is there a way to output the java data type to the console?
body: <p>I'm trying to debug a program I inherited. This program contains Strings, array lists and collections, lots of casting between types, and I need to do some String manipulations (<code>substring</code>, etc.) </p>
  
  <p>The data <em>look</em> like Strings when printed to the console (e.g., it's a line of text, like <code>Johnson, John</code> or <code>Chicago Region</code>), but my code is erroring out with various <code>index out of range</code> errors, suggesting that my code to cast to String isn't working. </p>
  
  <p>I'd like to try to figure out what data types are coming into and leaving my methods to verify that the program is acting as expected. Is there any way to find a field type in Java? In a perfect world, I could generate console output at every step that would give me the data value and whether it's a String, array list, or collection. Can that be done?</p>