This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Implementation of Stringobject and StringBuffer object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Implementation of Stringobject and StringBuffer object" Watch "Implementation of Stringobject and StringBuffer object" New topic
Author

Implementation of Stringobject and StringBuffer object

Venkat Ramsimha
Ranch Hand

Joined: Dec 28, 2004
Posts: 127
hi all,

Can anybody tell me the implementation of 'Stringobject' and 'StringBuffer object'alongwith its functionality and usage in the program


looking forward

tx
venkat(hunt:scjp1.4)
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Um .... right. You can download the source code for the JDK and look at String and StringBuffer's implementation if you really want, for some bizarre reason.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1844

HI,
I think these links will help you.
StringBuffer
String and StringBuffer


Krishna Srinivasan
Spring Tutorials, OCAJP Mock Questions, 400+ OCPJP Mock Questions
Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1844

HI,
I hope these links will help you.
StringBuffer
String and StringBuffer
Rob Harris
Greenhorn

Joined: Nov 11, 2004
Posts: 10
Make sure you know which methods belong to String, e.g., concat() and which to StringBuffer, e.g., append(). Remember that the substring(int beginIndex, int endIndex) uses a zero-based beginIndex but starts with 1 for the endIndex - (and has en evil lower-case 's' in substring).

But most of all, understand the difference between Strings - immutable objects - and StringBuffers - not-so-immutable objects.
i.e.:
String s = new String ("Java");
s.concat(" Rules!");
System.out.println(s);
StringBuffer sb = new StringBuffer("Java");
s.append(" Rocks!");
System.out.println(sb);

output:
Java
Java Rocks

why?
The line of code
s.concat(" Rules!");
created a new String "Java Rules!", but didn't attach a reference to it!

Have fun.

Rob
SCJP 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Implementation of Stringobject and StringBuffer object