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

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

Java program to check if user input is an even number

Archived Comments

1. iam getting intrest to watch this site
View Tutorial          By: monika at 2013-02-15 15:48:57

2. i like this site.good explanation,but it is good f
View Tutorial          By: mamata at 2010-08-16 05:22:53

3. Fantastic Post, can u pls tell me how can i pass q
View Tutorial          By: Kunal at 2012-08-07 07:02:41

4. I request to java beacuse i hope java language

View Tutorial          By: jeey at 2011-07-06 07:59:07

5. download jdk
View Tutorial          By: alireza esfandyarinezhad at 2011-03-07 11:52:55

6. Excellent Example...... To understand the concept
View Tutorial          By: SUNNY at 2009-02-24 23:41:04

7. thanks very much
View Tutorial          By: abrham at 2012-12-20 07:36:14

8. Thank you very much. This is the easiest and also
View Tutorial          By: Mehmet Üsküp at 2013-06-17 21:08:08

9. while compiling above program, iam getting this ER
View Tutorial          By: ss chary at 2013-07-15 08:06:18

10. you do the same as after
Private Sub Button

View Tutorial          By: John McCode at 2013-05-24 07:57:31