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. hi
i try to write a code for send data or s

View Tutorial          By: mjh at 2011-02-16 08:26:10

2. Nice one. I havn't thought of this before.
View Tutorial          By: Aniket Sawant at 2013-04-09 05:40:58

3. PLEASE I WANT A CODE TO BE PUT BEHIND A BUTTON SO
View Tutorial          By: KALUSHA at 2012-07-02 12:32:56

4. plz any one send me the code for sending and recei
View Tutorial          By: ankush at 2013-09-20 07:47:27

5. Hi,

I have a error like the import

View Tutorial          By: manigandavenkatesh at 2015-02-12 05:52:05

6. hii
i have

two varirables
View Tutorial          By: niranjan at 2012-07-31 06:47:36

7. in my case the culprit is xdebuger dll version 2.0
View Tutorial          By: putra at 2009-12-18 00:39:42

8. great.....
View Tutorial          By: rashid at 2009-12-07 03:22:46

9. Thanks for your nice article.I learned a lot
View Tutorial          By: Mahyar at 2012-08-12 12:09:36

10. It is really very good good notes of Public versus
View Tutorial          By: Nitin Gavande at 2011-07-16 08:47:56