How do I print the variable name holding my object?
For example, I have:
myclass ob=new myclass()
How would I print \"ob\"?
import java.lang.reflect.*; public class myclass { private myclass ob; public static void main(String args[]) { Field fd[] = myclass.class.getDeclaredFields(); for (int i = 0; i < fd.length; i++) { System.out.println(fd[i].getName()); } } }