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



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 Rajita, in accordance to our 'Privacy Policy' w
View Tutorial          By: webmaster at 2008-03-25 18:49:39

2. Hi,
Even if the while loops (in Producer an

View Tutorial          By: Pranay at 2012-09-19 19:08:45

3. can i use comma operator in simbolic constant in c
View Tutorial          By: Madheswaran at 2011-12-05 18:44:22

4. When i run the program,Iam getting this

View Tutorial          By: anitha at 2008-12-17 21:37:36

5. The example program by itself doesn't solve any pu
View Tutorial          By: Fazal at 2008-03-17 21:23:10

6. please give very easy program....this program is d
View Tutorial          By: rajesh at 2010-01-24 08:08:38

7. i tried your code but i got an error on this line<
View Tutorial          By: edward at 2011-12-09 11:32:30

8. 1. Performance

Object pooling provi

View Tutorial          By: sonia at 2013-09-21 20:22:49

9. i would like to ask that what is the history of a
View Tutorial          By: Ankit at 2011-02-07 09:56:21

10. help me in my final project about arrays
View Tutorial          By: grace at 2013-03-13 09:54:11