wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Clarification required in StringBuffer insert method... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Clarification required in StringBuffer insert method..." Watch "Clarification required in StringBuffer insert method..." New topic
Author

Clarification required in StringBuffer insert method...

S Thanigaivel
Ranch Hand

Joined: Oct 06, 2005
Posts: 60
Can any one explain me the functionality of the following code with an example



Thanks in advance!
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18523
    
  40

Well, according to the Javadoc for StringBuffer, it doesn't have the constructor that you are using. So this should not compile.

However, assuming you have a typo... according to the same javadoc, the method is an insertion of a string at an offset. In this case, the beginning of the string buffer. In your example, you are inserting a bunch of "0" into the beginning of the string buffer.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clarification required in StringBuffer insert method...
 
Similar Threads
Converting an integer to fixed length string
StringIndexOut OfBoundsException
Array Speed Issue
Crazy question
hashset?