• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

How many Object is created?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All ,

Can you tell me how many Objects are created created in Heap and in "String Literal Pool" when i execute the below code in java : --
Is tere any Pool memory affected by "Santanu"
?
StringBuffer sb = new StringBuffer("Santanu");

Thanks in Advance
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One string one StringBuffer.
next.
 
Marshal
Posts: 68964
275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch (after 2½ years ). There's no such thing as "urgent" here.
 
Sheriff
Posts: 21922
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

David O'Meara wrote:One string one StringBuffer.
next.


And one char[] inside the StringBuffer.
 
Campbell Ritchie
Marshal
Posts: 68964
275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and a char[] inside the String?

4 and counting
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can analyze output of de assembler and can conclude on number of objects created.

Run javap -c <class name> on your class and see the output.
 
Master Rancher
Posts: 3507
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Santanu Guha wrote:It's UGENT !!!


Fixed.
 
Hoo hoo hoo! Looks like we got a live one! Here, wave this tiny ad at it:
Try Free Java/.NET Libraries for Word Excel PowerPoint and PDF
htttp://www.e-iceblue.com/free-apis.html
    Bookmark Topic Watch Topic
  • New Topic