Exforsys

Online Training

Object Count..

This is a discussion on Object Count.. within the Java forums, part of the Programming Talk category; Can anybody help me to count how many objects are created during runtime in a java class as... As in... ...


Go Back   Exforsys > Programming Talk > Java

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-24-2007, 08:25 AM
Junior Member
 
Join Date: Sep 2007
Posts: 3
singhsn is on a distinguished road
Thumbs up Object Count..

Can anybody help me to count how many objects are created during runtime in a java class as...

As in...

String s1="abc";
s1.concat(s1);
s1.replace('a','z');

How many String objects will be created(With explanation please...)

Any help on this will be highly appreciated.
Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-02-2007, 12:36 PM
Junior Member
 
Join Date: Nov 2007
Posts: 8
vickyas400 is on a distinguished road
Hi.
Am not sure of your question. If you want to know the no of objects created by your class. You can have a counter variable in your constructor that can be just incremented . This will help to find out the no of objects actually created by the class.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-11-2007, 01:06 PM
amitky's Avatar
J2EE Prof.
 
Join Date: Dec 2007
Location: Bangalore
Posts: 7
amitky is on a distinguished road
Send a message via MSN to amitky Send a message via Yahoo to amitky
Hi

String functions always return a new string object after manipulation. So here there are 3 object created.
String s1="abc"; One s1
s1.concat(s1); One return of this
s1.replace('a','z'); One return of this
__________________
Amit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
QTP Material kalyansantosh Software Testing 5 05-08-2008 01:52 AM
Urgent - WinRunner user guide material priyapp Testing Tutorials 3 02-16-2007 03:37 AM
qtp&winreunner materail mattana_79 Testing Tutorials 1 02-14-2007 05:51 AM
Comp.software-eng FAQ (Part 0): periodic postings and archives David Alex Lamb Tech FAQ 2 05-23-2004 06:15 AM
comp.lang.eiffel Frequently Asked Questions (FAQ) Franck Arnaud Tech FAQ 0 04-17-2004 08:27 AM


All times are GMT -4. The time now is 12:02 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.