This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Names of Class<Throwable[]> objects and Semicolons

 
Campbell Ritchie
Sheriff
Posts: 48404
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have only just noticed that when I printed out the Throwable[] shown in this post, it didn’t come out as [Ljava.lang.Throwable@abcd1234. It printed [Ljava.lang.Throwable;@abcd1234. I had never noticed the semicolon before. It doesn’t say anything about semicolons in the JLS, nor in Object#toString().
Am I seeing things? Has that semicolon always been there?
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:I have only just noticed that when I printed out the Throwable[] shown in this post, it didn’t come out as [Ljava.lang.Throwable@abcd1234. It printed [Ljava.lang.Throwable;@abcd1234. I had never noticed the semicolon before. It doesn’t say anything about semicolons in the JLS, nor in Object#toString().
Am I seeing things? Has that semicolon always been there?

It does mention it in Object#toString(). The part before the @ is what is returned by class.getName() and the semicolon is part of an array's class name. So you will need to find out where that is documented to find out if it's always been there.
 
Campbell Ritchie
Sheriff
Posts: 48404
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Joanne
In Class#getName() it does say L[className; if it is an array. I had always seen the L. I had never noticed the ; before. If you go back to the days when it was Class rather than Class<?>, it says the same.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic