File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes is there a tool to monitor the java String pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "is there a tool to monitor the java String pool" Watch "is there a tool to monitor the java String pool" New topic
Author

is there a tool to monitor the java String pool

Ahmed Rezk
Greenhorn

Joined: Nov 22, 2006
Posts: 7
Question number 91 in ******, I am not persuaded with the answer, I think it should be answer D ( 4 strings ) , UNLESS substring does not create a new copy

I need to ask whether trim also returns a new string or not ( it is explicitly mentioned in the book that toUpperCase, toLowerCase, replace, concat return a new modified copy of the string � a new string is created in the pool but this is not explicitly mentioned for trim and substring?


<Possible real exam question deleted>

[ November 22, 2006: Message edited by: Barry Gaunt ]
[ February 01, 2007: Message edited by: Barry Gaunt ]
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
have you tried if trim() returns a new String ? Why should some operations on a String return new/modified String and some modify the content of the original String ?

A hint: Strings are immutable. You can not change them. So ALL modifications will result in a copy.


try this:

pascal
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

This sort of mind-numbingly fascinating question belongs in SCJP.


[Jess in Action][AskingGoodQuestions]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
******? - where did you get this question? Is this ****** a braindump site? We do not allow braindump questions on this site because the use of them for passing certifications is considered to be cheating.

If no explanation - this topic will be deleted in near future.

[ November 22, 2006: Message edited by: Barry Gaunt ]
[ February 01, 2007: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Chris Hendy
Ranch Hand

Joined: Mar 04, 2006
Posts: 98
I found this interesting article:

http://certcities.com/editorial/news/story.asp?EditorialsID=336&page=2

Braindump sites are now a Federal Crime.

Stick to K&B (or whatever your book of choice is) and mocks.
Chris Hendy
Ranch Hand

Joined: Mar 04, 2006
Posts: 98
As far as a tool is concerned, I have seen Jprofiler mentioned/recommended in a number of places. It's commercial but you can download an evaluation version.

http://www.ej-technologies.com/products/jprofiler/overview.html
[ November 22, 2006: Message edited by: Chris Hendy ]
 
Don't get me started about those stupid light bulbs.
 
subject: is there a tool to monitor the java String pool
 
Similar Threads
trim() method
String objects
again String anyone??
Java Strings
substring question