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. Gud one for beginners
View Tutorial          By: puneet at 2011-07-20 05:00:42

2. thanks to this site which get me understand about
View Tutorial          By: Sayak at 2012-10-08 15:57:25

3. Hi Andi, Stig and Derick!

Nice tur

View Tutorial          By: Lasse Christiansen at 2010-05-01 01:58:14

4. Hello, I have been using a very similar code on de
View Tutorial          By: Rod at 2011-11-13 15:09:52

5. Thanks ,got useful information on toString().
View Tutorial          By: jaffar at 2011-08-01 10:15:04

6. haiiiiiiiii sir , i have error in this program, er
View Tutorial          By: Vinod at 2012-07-31 12:23:19

7. Please don't use DataInputStream to read text. Unf
View Tutorial          By: Peter Lawrey at 2013-01-30 23:46:47

8. The DirSync sync intervals can be changed.

View Tutorial          By: Nitin at 2012-12-22 16:20:38

9. Please tell me the process, how to compile the mid
View Tutorial          By: Manish at 2008-11-14 13:33:43

10. Really a great article!
I have some questio

View Tutorial          By: ron at 2010-03-30 01:37:12