Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Threaded View

  1. #1
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default difference between String Concatenation and String -Buffer/Builder .append(<value>)

    in the book that im reading, the difference between concatenation and .append() doesnt explain the difference fully, only by some simple codes and some short statements implies a difference between the two

    given the following objects refers to a string value
    Concatenation:

    strObject = strObject + word;

     
    stringBufferObject.append(word);


    when i use an output statement(i.e System out), they dont differ too much, in fact they output in the same way, but one thing the book says that, with the use of StringBuffer or StringBuilder object, a program can avoid creating temporary String objects..

    its a bit complicated on my part. i need some low level english to understand this part

    what is the difference between a basic string concatenation and using .append(<string value>) of String Buffer/Builder object.
    Last edited by chronoz13; September 2nd, 2011 at 03:03 AM.


Similar Threads

  1. private Map<String, ArrayList> xlist = new HashMap<String, ArrayList>();
    By Scotty in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 21st, 2011, 08:37 AM
  2. Replies: 18
    Last Post: March 2nd, 2011, 10:52 AM
  3. [SOLVED] String Matcher finding only char not a whole string
    By Kakashi in forum What's Wrong With My Code?
    Replies: 11
    Last Post: February 18th, 2011, 09:58 AM
  4. Replies: 2
    Last Post: December 22nd, 2010, 09:21 AM
  5. Replies: 2
    Last Post: November 3rd, 2009, 06:28 AM