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



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. welll program runs but fails at the statement wher
View Tutorial          By: Aman Aggarwal at 2009-03-22 22:42:52

2. how to create inode address using c++
View Tutorial          By: pooja at 2014-06-24 05:50:33

3. HI All,

I am using this code but fo

View Tutorial          By: muna at 2015-07-04 12:28:15

4. Whenever i run this program, it terminates immedia
View Tutorial          By: Salman at 2015-03-26 08:23:32

5. hello all,
i have this error.
Except

View Tutorial          By: daniel at 2012-08-12 18:50:04

6. Nice and easy to understand......Thanks for same
View Tutorial          By: vikas at 2011-07-21 07:44:30

7. it 's great
View Tutorial          By: tanawat bhtk at 2008-03-19 22:17:53

8. Thanks lot tutor.
View Tutorial          By: veda murthy at 2013-08-01 09:33:43

9. Thanks for the tutorial. I didn't get a lot of tra
View Tutorial          By: jordan at 2012-05-16 13:03:45

10. thanks emily, this was fantastic... just saved me
View Tutorial          By: philip at 2010-04-10 20:39:08