String and StringBuilder performance ratio of

// String StringBuilder performance ratio of the
Package seday01;
/ **
* String modify performance overhead caused by the string
* @author xingsir
*
* /
public class StringDemo2 {
public static void main (String [] args) {
String = STR " A ";
for (int I = 0; I <10000000; I ++) {
STR STR + =" A ";
}
System.out.println (" finished "!);
}
}


//=============================================================================

Package seday01 //;
/// **
// modify the performance of the StringBuilder string *
// * @author xingsir
// *
// * /
// public class StringDemo3 {
// public static void main (String [] args) {
// the StringBuilder the StringBuilder Builder new new = ( "A");
// for (int I = 0; I <10000000; I ++) {
// builder.append ( "A");
//}
// the System.out. println ( "finished!");
//}
//}

Guess you like

Origin www.cnblogs.com/xingsir/p/11978045.html