It depends actually. If you have a Class, and you want to know the field/method names of a class.
TestClass obj = new TestClass(); Class<TestClass> classRef = (Class<TestClass>) obj.getClass(); Field[] fields = classRef.getFields(); for(Field field: fields){ System.out.println(field.getName()); } This will print a list of fields names in this class. But, if you just have a reference, and you want to printout it's string value, it's not possible. 2010/11/3 Kostya Vasilyev <kmans...@gmail.com> > Suppose this was possible, what would you do with the name as a string? > > -- > Kostya Vasilyev -- http://kmansoft.wordpress.com > > 03.11.2010 20:48 пользователь "Darkside Android" < > darksideandr...@gmail.com> написал: > > > Object objRef = new Object(); > > String nameOfObjRef = "objRef"; << this is what I need returned. Is > this possible? > > > On Nov 3, 10:11 am, Kumar Bibek <coomar....@gmail.com> wrote: > > name of an object reference? > > > > On Wed, Nov 3, 2010 at 10:37 PM, Darkside Android < > darksideandr...@gmail.com > > > > > > wrote: > > > Object getThisObjName= new Object(); > > > > > I'd like to get the name of an object re... > > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > <android-developers%2bunsubscr...@googlegroups.com<android-developers%252bunsubscr...@googlegroups.com> > > > > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en... > > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" ... > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en