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. i have a program in which we have to find the summ
View Tutorial          By: Navjyot at 2013-01-28 10:38:55

2. it is good site , and i have cleared my doubts
View Tutorial          By: imtiaz at 2009-10-15 23:43:50

3. Tnx. Very fast learning i think.
Just make

View Tutorial          By: mahdi at 2011-07-09 20:20:39

4. Can you mail me the compiled files, Please. Thank
View Tutorial          By: raghav at 2010-09-14 21:23:17

5. Good explanation, Thanks.
View Tutorial          By: bram at 2011-05-06 03:37:54

6. Yeah..it's very good example....
View Tutorial          By: Packiyaraj.T at 2010-07-22 22:39:48

7. hi, this is a good example and this rely helpful i
View Tutorial          By: Dhaval PATOLIYA at 2015-09-08 06:55:38

8. This is very useful example for beginners.

View Tutorial          By: Amresh at 2011-02-28 22:20:11

9. just I am need of some of the soft copy related to
View Tutorial          By: shani at 2015-08-12 06:01:05

10. Right, so were is the tutorial files.zip?
O

View Tutorial          By: jeremy at 2011-10-24 15:58:40