Comment on Tutorial - append() in Java By Jagan



Comment Added by : Mohamed firnaz

Comment Added at : 2011-12-07 04:54:27

Comment on Tutorial : append() in Java By Jagan
Excellent. I want you to publish about memory allocation for every sample programs side by side, as it plays a major role in live projects. For example :

public class stringmemory
{
public static void main(String[] args){
String str = "Sri seshaa";
String str1 = " Sri seshaa";
String str2 = str + str1 + " technologies";

StringBuffer s;
String d;
StringBuffer bufr = new StringBuffer(str);
s = bufr.append(str2);
d = String.valueOf(str);
System.out.println("......");
System.out.println(str2);
System.out.println("......");
System.out.println(d);
}
}

In this the memory allocated for concatenation in string class is more compared to the append operation in StringBuffer. Like this there are many advantages and disadvantages in it. Please publish it also, it will be helpful for the young programmers like me.


View Tutorial



Ask a Question

Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Best
Thanks

View Tutorial          By: Sujit at 2009-01-12 22:38:08

2. Thanks for the tips.

I hesitated to

View Tutorial          By: Dick at 2011-10-09 15:21:50

3. i really have to thank you for the wonderful fluid
View Tutorial          By: Joel Pereira at 2011-03-19 22:08:58

4. Why can't you just use an array for something like
View Tutorial          By: Andrea at 2012-10-18 00:17:48

5. Hi,

I am using this code and gettin

View Tutorial          By: Akanksha at 2014-01-20 10:31:31

6. Thank you , It is really good for beginners.
View Tutorial          By: Satish Kumar at 2010-01-18 03:06:49

7. hi i m vinit jain. i m working on the same project
View Tutorial          By: vinit jain at 2010-02-09 12:16:01

8. Good Introduction to start j2me.thanks
View Tutorial          By: Ravinder Kasarla at 2008-12-26 06:59:29

9. thanks happy to see such a site about java!
View Tutorial          By: nnnmore at 2007-03-16 06:29:20

10. Buenisimo tutorial, este rebuena la cosa
Gr

View Tutorial          By: Popoca at 2010-04-20 15:50:29