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. when i copy paste your program or source code

View Tutorial          By: hello at 2010-07-09 18:56:23

2. good one.......thanks
View Tutorial          By: raghubir at 2012-11-10 19:01:45

3. java program to maintain the books details like Bo
View Tutorial          By: Prabha at 2013-08-28 12:34:00

4. Been hearing about this for quite long. This gives
View Tutorial          By: Lolip at 2011-08-24 08:40:20

5. its very useful...........
View Tutorial          By: abiraman at 2013-01-27 09:17:54

6. cool.
View Tutorial          By: Fahad Palomo at 2011-08-03 06:19:56

7. this code is running successfully
View Tutorial          By: Amit Agarwal at 2013-03-08 10:56:39

8. This isn't entirely correct. A class can be abstra
View Tutorial          By: Jay at 2013-01-30 14:52:15

9. Whenever i run this program, it terminates immedia
View Tutorial          By: Salman at 2015-03-26 08:23:32

10. Great Sample, it helped me alot

Tha

View Tutorial          By: Mike at 2010-03-02 04:39:57