You can print the variable name since Java 8 version: Java Reflection: How to get the name of a variable?
You can print the value using something like: System.out.println(String.valueOf(var));
Through Java reflection you can get more information from a variable, such as class name, package name, class attributes, etc...