• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is there any way to determine the class of a random anonymous object?  RSS feed

 
Greenhorn
Posts: 3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wanted to know Is there any way to determine the class of a random anonymous object?
 
Rancher
Posts: 42972
73
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can call obj.getClass().getName().
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But it would be a good idea to assign the object to a variable first, so you can use it later. It will then cease to be an anonymous object.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!