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. nice article...........................
View Tutorial          By: abhijit at 2012-09-24 11:12:46

2. Hello,

When I put the source code i

View Tutorial          By: Pascal at 2013-03-25 09:12:47

3. @Brian rename the file name to match the class nam
View Tutorial          By: QuangQUang at 2015-09-27 14:44:37

4. Thanks this tutorial helped me :)
View Tutorial          By: Anuja at 2012-07-17 06:59:39

5. no output is shown
View Tutorial          By: shubham bansal at 2015-02-21 15:36:31

6. change
for(counter=0;counter<=length-1;l

View Tutorial          By: Dan at 2012-05-28 04:53:14

7. lolz what's the code not working in JSP may be sen
View Tutorial          By: lolz at 2008-12-10 03:31:50

8. very helpful.
View Tutorial          By: arjun at 2011-07-19 03:19:44

9. I am using VS2010 & SAP for crystal report. I
View Tutorial          By: Abdullah Al Mamun at 2011-08-11 23:20:37

10. hello
thanks for your code
It works

View Tutorial          By: m_karimi at 2008-10-24 12:08:06