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. excellent..... thanks it help me a lot.......
View Tutorial          By: REJAPUTRA at 2009-10-23 09:19:25

2. Excellent.. simple and too good to understand
View Tutorial          By: venkat at 2010-05-11 00:30:02

3. I have a sample code in which,

obje

View Tutorial          By: Tan Mi at 2011-10-25 23:24:10

4. thanks for posting
View Tutorial          By: sriram at 2011-11-24 06:38:42

5. ..how if the input is THE DOG BARKS then the outpu
View Tutorial          By: dharel at 2011-01-28 02:53:19

6. Really nice explanation...
nice to understa

View Tutorial          By: Parth Kansara at 2011-06-21 02:11:52

7. great work..keep it up.
View Tutorial          By: faizaan at 2011-04-29 12:23:39

8. PROGRAMMING SUPERB
View Tutorial          By: vinay sharma at 2010-10-01 05:16:23

9. Gives a syntax error
View Tutorial          By: Siddharth at 2015-06-10 05:15:00

10. Very good.
But is this (Accessor functions

View Tutorial          By: peter at 2011-07-20 13:13:44