How do I print the variable name holding my object?
For example, I have:
myclass ob=new myclass()
How would I print \"ob\"?
I'm assuming you want a way to "print" an object, in which case, you'll first want to override the toString() method for your object. This will allow you to specify what an object of your type returns when you call toString().
Then, you can simply do System.out.println(MyObject);
This will implicitly call MyObject's toString().