File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please clarify on number of strings

 
Kunal Kumar
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Consider the following code snippet from K&B (Chapter 6)



The book says - There were a total of eight String objects created as follows: "spring", "summer " (lost), "spring summer", "fall" (lost), "spring fall" (lost), "spring summer spring" (lost), "winter" (lost), "spring winter" (at this point "spring" is lost).

My Question is - Why are we missing an string ( which is embedded in print statement, i.e., " ") while counting the number of string objects? This *SPACE* string ( " " ) is also an string objects created in string pool. so the number of string object created should be 9. Please confirm!

Thanks!
[ February 08, 2007: Message edited by: Barry Gaunt ]
 
Anton Uwe
Ranch Hand
Posts: 122
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iirc a part of the question was "prior to the println()-statement".
 
Kunal Kumar
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh!!

Thanks for clarification!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic